dhcp.cgi: Fix for bug #12050

Message ID trinity-27870ff7-5e8c-4923-a575-41117857fda7-1559643840434@3c-app-gmx-bs71
State Accepted
Headers
Series dhcp.cgi: Fix for bug #12050 |

Commit Message

Bernhard Bitsch June 4, 2019, 8:24 p.m. UTC
  Save fixed leases to file after addition of a new lease

Signed-off-by: Bernhard Bitsch <bbitsch@ipfire.org>

---
 html/cgi-bin/dhcp.cgi | 3 +++
 1 file changed, 3 insertions(+)

--
2.21.0.windows.1
  

Comments

Michael Tremer June 4, 2019, 10:33 p.m. UTC | #1
I think this patch has been submitted before.

Why was it submitted again? What has changed?

-Michael

> On 4 Jun 2019, at 11:24, Bernhard Bitsch <Bernhard.Bitsch@gmx.de> wrote:
> 
> Save fixed leases to file after addition of a new lease
> 
> Signed-off-by: Bernhard Bitsch <bbitsch@ipfire.org>
> 
> ---
> html/cgi-bin/dhcp.cgi | 3 +++
> 1 file changed, 3 insertions(+)
> 
> diff --git a/html/cgi-bin/dhcp.cgi b/html/cgi-bin/dhcp.cgi
> index 675d80012..19c55eb6d 100644
> --- a/html/cgi-bin/dhcp.cgi
> +++ b/html/cgi-bin/dhcp.cgi
> @@ -443,6 +443,9 @@ if ($dhcpsettings{'ACTION'} eq $Lang::tr{'add'}.'2') {
> 	$dhcpsettings{'FIX_ROOTPATH'} = &Header::cleanhtml($dhcpsettings{'FIX_ROOTPATH'});
> 	if ($dhcpsettings{'KEY2'} eq '') { #add or edit ?
> 	    unshift (@current2, "$dhcpsettings{'FIX_MAC'},$dhcpsettings{'FIX_ADDR'},$dhcpsettings{'FIX_ENABLED'},$dhcpsettings{'FIX_NEXTADDR'},$dhcpsettings{'FIX_FILENAME'},$dhcpsettings{'FIX_ROOTPATH'},$dhcpsettings{'FIX_REMARK'}\n");
> +	    open(FILE, ">$filename2") or die 'Unable to open fixed lease file.';
> +	    print FILE @current2;
> +	    close(FILE);
> 	    &General::log($Lang::tr{'fixed ip lease added'});
> 
> 	    # Enter edit mode
> --
> 2.21.0.windows.1
>
  
Bernhard Bitsch June 4, 2019, 10:45 p.m. UTC | #2
I've just completed the subject.

-Bernhard

> Gesendet: Dienstag, 04. Juni 2019 um 14:33 Uhr
> Von: "Michael Tremer" <michael.tremer@ipfire.org>
> An: "Bernhard Bitsch" <Bernhard.Bitsch@gmx.de>
> Cc: "IPFire Development" <development@lists.ipfire.org>
> Betreff: Re: [PATCH] dhcp.cgi: Fix for bug #12050
>
> I think this patch has been submitted before.
>
> Why was it submitted again? What has changed?
>
> -Michael
>
> > On 4 Jun 2019, at 11:24, Bernhard Bitsch <Bernhard.Bitsch@gmx.de> wrote:
> >
> > Save fixed leases to file after addition of a new lease
> >
> > Signed-off-by: Bernhard Bitsch <bbitsch@ipfire.org>
> >
> > ---
> > html/cgi-bin/dhcp.cgi | 3 +++
> > 1 file changed, 3 insertions(+)
> >
> > diff --git a/html/cgi-bin/dhcp.cgi b/html/cgi-bin/dhcp.cgi
> > index 675d80012..19c55eb6d 100644
> > --- a/html/cgi-bin/dhcp.cgi
> > +++ b/html/cgi-bin/dhcp.cgi
> > @@ -443,6 +443,9 @@ if ($dhcpsettings{'ACTION'} eq $Lang::tr{'add'}.'2') {
> > 	$dhcpsettings{'FIX_ROOTPATH'} = &Header::cleanhtml($dhcpsettings{'FIX_ROOTPATH'});
> > 	if ($dhcpsettings{'KEY2'} eq '') { #add or edit ?
> > 	    unshift (@current2, "$dhcpsettings{'FIX_MAC'},$dhcpsettings{'FIX_ADDR'},$dhcpsettings{'FIX_ENABLED'},$dhcpsettings{'FIX_NEXTADDR'},$dhcpsettings{'FIX_FILENAME'},$dhcpsettings{'FIX_ROOTPATH'},$dhcpsettings{'FIX_REMARK'}\n");
> > +	    open(FILE, ">$filename2") or die 'Unable to open fixed lease file.';
> > +	    print FILE @current2;
> > +	    close(FILE);
> > 	    &General::log($Lang::tr{'fixed ip lease added'});
> >
> > 	    # Enter edit mode
> > --
> > 2.21.0.windows.1
> >
>
>
  
Michael Tremer June 5, 2019, 7:05 p.m. UTC | #3
Hello,

I merged this patch.

I had to spend a little time to figure out what you actually wanted to achieve here. It would have helped to add to the commit message that the expected behaviour just wasn’t programmed into the file and that this patch now changes that.

I updated the commit message for your future reference. Please read through that and take some inspiration from that with your next patch.

I am happy that we can finally close this bug.

Best,
-Michael

> On 4 Jun 2019, at 11:24, Bernhard Bitsch <Bernhard.Bitsch@gmx.de> wrote:
> 
> Save fixed leases to file after addition of a new lease
> 
> Signed-off-by: Bernhard Bitsch <bbitsch@ipfire.org>
> 
> ---
> html/cgi-bin/dhcp.cgi | 3 +++
> 1 file changed, 3 insertions(+)
> 
> diff --git a/html/cgi-bin/dhcp.cgi b/html/cgi-bin/dhcp.cgi
> index 675d80012..19c55eb6d 100644
> --- a/html/cgi-bin/dhcp.cgi
> +++ b/html/cgi-bin/dhcp.cgi
> @@ -443,6 +443,9 @@ if ($dhcpsettings{'ACTION'} eq $Lang::tr{'add'}.'2') {
> 	$dhcpsettings{'FIX_ROOTPATH'} = &Header::cleanhtml($dhcpsettings{'FIX_ROOTPATH'});
> 	if ($dhcpsettings{'KEY2'} eq '') { #add or edit ?
> 	    unshift (@current2, "$dhcpsettings{'FIX_MAC'},$dhcpsettings{'FIX_ADDR'},$dhcpsettings{'FIX_ENABLED'},$dhcpsettings{'FIX_NEXTADDR'},$dhcpsettings{'FIX_FILENAME'},$dhcpsettings{'FIX_ROOTPATH'},$dhcpsettings{'FIX_REMARK'}\n");
> +	    open(FILE, ">$filename2") or die 'Unable to open fixed lease file.';
> +	    print FILE @current2;
> +	    close(FILE);
> 	    &General::log($Lang::tr{'fixed ip lease added'});
> 
> 	    # Enter edit mode
> --
> 2.21.0.windows.1
>
  
Bernhard Bitsch June 5, 2019, 9:13 p.m. UTC | #4
Hello,

Thanks for the merge.

> Gesendet: Mittwoch, 05. Juni 2019 um 11:05 Uhr
> Von: "Michael Tremer" <michael.tremer@ipfire.org>
> An: "Bernhard Bitsch" <Bernhard.Bitsch@gmx.de>
> Cc: "IPFire Development" <development@lists.ipfire.org>
> Betreff: Re: [PATCH] dhcp.cgi: Fix for bug #12050
>
> Hello,
> 
> I merged this patch.
> 
> I had to spend a little time to figure out what you actually wanted to achieve here. It would have helped to add to the commit message that the expected behaviour just wasn’t programmed into the file and that this patch now changes that.
> 

The commit message just describes what has changed. The new entry is just added to the file.
It is not the "one-click-solution" I would prefer, too.
I can submit a patch for this functionality, if we want to do it this way.

> I updated the commit message for your future reference. Please read through that and take some inspiration from that with your next patch.
>
I've read your message. If the patch contained this functionality I would have stated that in this way.
 
> I am happy that we can finally close this bug.
>
So am I.

Best,
Bernhard
 
> Best,
> -Michael
> 
> > On 4 Jun 2019, at 11:24, Bernhard Bitsch <Bernhard.Bitsch@gmx.de> wrote:
> > 
> > Save fixed leases to file after addition of a new lease
> > 
> > Signed-off-by: Bernhard Bitsch <bbitsch@ipfire.org>
> > 
> > ---
> > html/cgi-bin/dhcp.cgi | 3 +++
> > 1 file changed, 3 insertions(+)
> > 
> > diff --git a/html/cgi-bin/dhcp.cgi b/html/cgi-bin/dhcp.cgi
> > index 675d80012..19c55eb6d 100644
> > --- a/html/cgi-bin/dhcp.cgi
> > +++ b/html/cgi-bin/dhcp.cgi
> > @@ -443,6 +443,9 @@ if ($dhcpsettings{'ACTION'} eq $Lang::tr{'add'}.'2') {
> > 	$dhcpsettings{'FIX_ROOTPATH'} = &Header::cleanhtml($dhcpsettings{'FIX_ROOTPATH'});
> > 	if ($dhcpsettings{'KEY2'} eq '') { #add or edit ?
> > 	    unshift (@current2, "$dhcpsettings{'FIX_MAC'},$dhcpsettings{'FIX_ADDR'},$dhcpsettings{'FIX_ENABLED'},$dhcpsettings{'FIX_NEXTADDR'},$dhcpsettings{'FIX_FILENAME'},$dhcpsettings{'FIX_ROOTPATH'},$dhcpsettings{'FIX_REMARK'}\n");
> > +	    open(FILE, ">$filename2") or die 'Unable to open fixed lease file.';
> > +	    print FILE @current2;
> > +	    close(FILE);
> > 	    &General::log($Lang::tr{'fixed ip lease added'});
> > 
> > 	    # Enter edit mode
> > --
> > 2.21.0.windows.1
> > 
> 
>
  
Michael Tremer June 5, 2019, 10:06 p.m. UTC | #5
Hi,

> On 5 Jun 2019, at 12:13, Bernhard Bitsch <Bernhard.Bitsch@gmx.de> wrote:
> 
> Hello,
> 
> Thanks for the merge.
> 
>> Gesendet: Mittwoch, 05. Juni 2019 um 11:05 Uhr
>> Von: "Michael Tremer" <michael.tremer@ipfire.org>
>> An: "Bernhard Bitsch" <Bernhard.Bitsch@gmx.de>
>> Cc: "IPFire Development" <development@lists.ipfire.org>
>> Betreff: Re: [PATCH] dhcp.cgi: Fix for bug #12050
>> 
>> Hello,
>> 
>> I merged this patch.
>> 
>> I had to spend a little time to figure out what you actually wanted to achieve here. It would have helped to add to the commit message that the expected behaviour just wasn’t programmed into the file and that this patch now changes that.
>> 
> 
> The commit message just describes what has changed. The new entry is just added to the file.
> It is not the "one-click-solution" I would prefer, too.
> I can submit a patch for this functionality, if we want to do it this way.

I tested the patch and I could add an extra from the fixed list with one click.

What are you referring to?

> 
>> I updated the commit message for your future reference. Please read through that and take some inspiration from that with your next patch.
>> 
> I've read your message. If the patch contained this functionality I would have stated that in this way.

What does the patch do from your point of view?

> 
>> I am happy that we can finally close this bug.
>> 
> So am I.
> 
> Best,
> Bernhard
> 
>> Best,
>> -Michael
>> 
>>> On 4 Jun 2019, at 11:24, Bernhard Bitsch <Bernhard.Bitsch@gmx.de> wrote:
>>> 
>>> Save fixed leases to file after addition of a new lease
>>> 
>>> Signed-off-by: Bernhard Bitsch <bbitsch@ipfire.org>
>>> 
>>> ---
>>> html/cgi-bin/dhcp.cgi | 3 +++
>>> 1 file changed, 3 insertions(+)
>>> 
>>> diff --git a/html/cgi-bin/dhcp.cgi b/html/cgi-bin/dhcp.cgi
>>> index 675d80012..19c55eb6d 100644
>>> --- a/html/cgi-bin/dhcp.cgi
>>> +++ b/html/cgi-bin/dhcp.cgi
>>> @@ -443,6 +443,9 @@ if ($dhcpsettings{'ACTION'} eq $Lang::tr{'add'}.'2') {
>>> 	$dhcpsettings{'FIX_ROOTPATH'} = &Header::cleanhtml($dhcpsettings{'FIX_ROOTPATH'});
>>> 	if ($dhcpsettings{'KEY2'} eq '') { #add or edit ?
>>> 	    unshift (@current2, "$dhcpsettings{'FIX_MAC'},$dhcpsettings{'FIX_ADDR'},$dhcpsettings{'FIX_ENABLED'},$dhcpsettings{'FIX_NEXTADDR'},$dhcpsettings{'FIX_FILENAME'},$dhcpsettings{'FIX_ROOTPATH'},$dhcpsettings{'FIX_REMARK'}\n");
>>> +	    open(FILE, ">$filename2") or die 'Unable to open fixed lease file.';
>>> +	    print FILE @current2;
>>> +	    close(FILE);
>>> 	    &General::log($Lang::tr{'fixed ip lease added'});
>>> 
>>> 	    # Enter edit mode
>>> --
>>> 2.21.0.windows.1
>>> 
>> 
>>
  
Bernhard Bitsch June 5, 2019, 11:10 p.m. UTC | #6
Hi,

> Gesendet: Mittwoch, 05. Juni 2019 um 14:06 Uhr
> Von: "Michael Tremer" <michael.tremer@ipfire.org>
> An: "Bernhard Bitsch" <Bernhard.Bitsch@gmx.de>
> Cc: "IPFire Development" <development@lists.ipfire.org>
> Betreff: Re: [PATCH] dhcp.cgi: Fix for bug #12050
>
> Hi,
> 
> > On 5 Jun 2019, at 12:13, Bernhard Bitsch <Bernhard.Bitsch@gmx.de> wrote:
> > 
> > Hello,
> > 
> > Thanks for the merge.
> > 
> >> Gesendet: Mittwoch, 05. Juni 2019 um 11:05 Uhr
> >> Von: "Michael Tremer" <michael.tremer@ipfire.org>
> >> An: "Bernhard Bitsch" <Bernhard.Bitsch@gmx.de>
> >> Cc: "IPFire Development" <development@lists.ipfire.org>
> >> Betreff: Re: [PATCH] dhcp.cgi: Fix for bug #12050
> >> 
> >> Hello,
> >> 
> >> I merged this patch.
> >> 
> >> I had to spend a little time to figure out what you actually wanted to achieve here. It would have helped to add to the commit message that the expected behaviour just wasn’t programmed into the file and that this patch now changes that.
> >> 
> > 
> > The commit message just describes what has changed. The new entry is just added to the file.
> > It is not the "one-click-solution" I would prefer, too.
> > I can submit a patch for this functionality, if we want to do it this way.
> 
> I tested the patch and I could add an extra from the fixed list with one click.
> 
> What are you referring to?
> 

Okay it is a mix-up. For editing the new entry is added to the fixed leases list. Thus if I skip the edit step, the entry is contained anyway, but it is not sorted in.
A one-click-solution should add the new entry, sort the list and return to default state of the page.

> > 
> >> I updated the commit message for your future reference. Please read through that and take some inspiration from that with your next patch.
> >> 
> > I've read your message. If the patch contained this functionality I would have stated that in this way.
> 
> What does the patch do from your point of view?
> 

It only synchronises the internal fixed leases list and the fixed leases file, without synching the sort order. 

> > 
> >> I am happy that we can finally close this bug.
> >> 
> > So am I.
> > 
> > Best,
> > Bernhard
> > 
> >> Best,
> >> -Michael
> >> 
> >>> On 4 Jun 2019, at 11:24, Bernhard Bitsch <Bernhard.Bitsch@gmx.de> wrote:
> >>> 
> >>> Save fixed leases to file after addition of a new lease
> >>> 
> >>> Signed-off-by: Bernhard Bitsch <bbitsch@ipfire.org>
> >>> 
> >>> ---
> >>> html/cgi-bin/dhcp.cgi | 3 +++
> >>> 1 file changed, 3 insertions(+)
> >>> 
> >>> diff --git a/html/cgi-bin/dhcp.cgi b/html/cgi-bin/dhcp.cgi
> >>> index 675d80012..19c55eb6d 100644
> >>> --- a/html/cgi-bin/dhcp.cgi
> >>> +++ b/html/cgi-bin/dhcp.cgi
> >>> @@ -443,6 +443,9 @@ if ($dhcpsettings{'ACTION'} eq $Lang::tr{'add'}.'2') {
> >>> 	$dhcpsettings{'FIX_ROOTPATH'} = &Header::cleanhtml($dhcpsettings{'FIX_ROOTPATH'});
> >>> 	if ($dhcpsettings{'KEY2'} eq '') { #add or edit ?
> >>> 	    unshift (@current2, "$dhcpsettings{'FIX_MAC'},$dhcpsettings{'FIX_ADDR'},$dhcpsettings{'FIX_ENABLED'},$dhcpsettings{'FIX_NEXTADDR'},$dhcpsettings{'FIX_FILENAME'},$dhcpsettings{'FIX_ROOTPATH'},$dhcpsettings{'FIX_REMARK'}\n");
> >>> +	    open(FILE, ">$filename2") or die 'Unable to open fixed lease file.';
> >>> +	    print FILE @current2;
> >>> +	    close(FILE);
> >>> 	    &General::log($Lang::tr{'fixed ip lease added'});
> >>> 
> >>> 	    # Enter edit mode
> >>> --
> >>> 2.21.0.windows.1
> >>> 
> >> 
> >> 
> 
>
  
Michael Tremer June 5, 2019, 11:26 p.m. UTC | #7
> On 5 Jun 2019, at 14:10, Bernhard Bitsch <Bernhard.Bitsch@gmx.de> wrote:
> 
> Hi,
> 
>> Gesendet: Mittwoch, 05. Juni 2019 um 14:06 Uhr
>> Von: "Michael Tremer" <michael.tremer@ipfire.org>
>> An: "Bernhard Bitsch" <Bernhard.Bitsch@gmx.de>
>> Cc: "IPFire Development" <development@lists.ipfire.org>
>> Betreff: Re: [PATCH] dhcp.cgi: Fix for bug #12050
>> 
>> Hi,
>> 
>>> On 5 Jun 2019, at 12:13, Bernhard Bitsch <Bernhard.Bitsch@gmx.de> wrote:
>>> 
>>> Hello,
>>> 
>>> Thanks for the merge.
>>> 
>>>> Gesendet: Mittwoch, 05. Juni 2019 um 11:05 Uhr
>>>> Von: "Michael Tremer" <michael.tremer@ipfire.org>
>>>> An: "Bernhard Bitsch" <Bernhard.Bitsch@gmx.de>
>>>> Cc: "IPFire Development" <development@lists.ipfire.org>
>>>> Betreff: Re: [PATCH] dhcp.cgi: Fix for bug #12050
>>>> 
>>>> Hello,
>>>> 
>>>> I merged this patch.
>>>> 
>>>> I had to spend a little time to figure out what you actually wanted to achieve here. It would have helped to add to the commit message that the expected behaviour just wasn’t programmed into the file and that this patch now changes that.
>>>> 
>>> 
>>> The commit message just describes what has changed. The new entry is just added to the file.
>>> It is not the "one-click-solution" I would prefer, too.
>>> I can submit a patch for this functionality, if we want to do it this way.
>> 
>> I tested the patch and I could add an extra from the fixed list with one click.
>> 
>> What are you referring to?
>> 
> 
> Okay it is a mix-up. For editing the new entry is added to the fixed leases list. Thus if I skip the edit step, the entry is contained anyway, but it is not sorted in.
> A one-click-solution should add the new entry, sort the list and return to default state of the page.

This is intentional that the page remains in edit mode. People usually want to change the remark or hostname. If you have a list of 200 leases, then finding the one that you have just added can be a pain. That is why this is there.

> 
>>> 
>>>> I updated the commit message for your future reference. Please read through that and take some inspiration from that with your next patch.
>>>> 
>>> I've read your message. If the patch contained this functionality I would have stated that in this way.
>> 
>> What does the patch do from your point of view?
>> 
> 
> It only synchronises the internal fixed leases list and the fixed leases file, without synching the sort order. 

Is that a problem when they are not sorted? By what would it be best to sort them? I do not think that the MAC address is a good option. Finding something in there is impossible as soon as the list becomes large.

> 
>>> 
>>>> I am happy that we can finally close this bug.
>>>> 
>>> So am I.
>>> 
>>> Best,
>>> Bernhard
>>> 
>>>> Best,
>>>> -Michael
>>>> 
>>>>> On 4 Jun 2019, at 11:24, Bernhard Bitsch <Bernhard.Bitsch@gmx.de> wrote:
>>>>> 
>>>>> Save fixed leases to file after addition of a new lease
>>>>> 
>>>>> Signed-off-by: Bernhard Bitsch <bbitsch@ipfire.org>
>>>>> 
>>>>> ---
>>>>> html/cgi-bin/dhcp.cgi | 3 +++
>>>>> 1 file changed, 3 insertions(+)
>>>>> 
>>>>> diff --git a/html/cgi-bin/dhcp.cgi b/html/cgi-bin/dhcp.cgi
>>>>> index 675d80012..19c55eb6d 100644
>>>>> --- a/html/cgi-bin/dhcp.cgi
>>>>> +++ b/html/cgi-bin/dhcp.cgi
>>>>> @@ -443,6 +443,9 @@ if ($dhcpsettings{'ACTION'} eq $Lang::tr{'add'}.'2') {
>>>>> 	$dhcpsettings{'FIX_ROOTPATH'} = &Header::cleanhtml($dhcpsettings{'FIX_ROOTPATH'});
>>>>> 	if ($dhcpsettings{'KEY2'} eq '') { #add or edit ?
>>>>> 	    unshift (@current2, "$dhcpsettings{'FIX_MAC'},$dhcpsettings{'FIX_ADDR'},$dhcpsettings{'FIX_ENABLED'},$dhcpsettings{'FIX_NEXTADDR'},$dhcpsettings{'FIX_FILENAME'},$dhcpsettings{'FIX_ROOTPATH'},$dhcpsettings{'FIX_REMARK'}\n");
>>>>> +	    open(FILE, ">$filename2") or die 'Unable to open fixed lease file.';
>>>>> +	    print FILE @current2;
>>>>> +	    close(FILE);
>>>>> 	    &General::log($Lang::tr{'fixed ip lease added'});
>>>>> 
>>>>> 	    # Enter edit mode
>>>>> --
>>>>> 2.21.0.windows.1
  
Bernhard Bitsch June 6, 2019, 12:03 a.m. UTC | #8
> Gesendet: Mittwoch, 05. Juni 2019 um 15:26 Uhr
> Von: "Michael Tremer" <michael.tremer@ipfire.org>
> An: "Bernhard Bitsch" <Bernhard.Bitsch@gmx.de>
> Cc: "IPFire Development" <development@lists.ipfire.org>
> Betreff: Re: [PATCH] dhcp.cgi: Fix for bug #12050
>
> 
> 
> > On 5 Jun 2019, at 14:10, Bernhard Bitsch <Bernhard.Bitsch@gmx.de> wrote:
> > 
> > Hi,
> > 
> >> Gesendet: Mittwoch, 05. Juni 2019 um 14:06 Uhr
> >> Von: "Michael Tremer" <michael.tremer@ipfire.org>
> >> An: "Bernhard Bitsch" <Bernhard.Bitsch@gmx.de>
> >> Cc: "IPFire Development" <development@lists.ipfire.org>
> >> Betreff: Re: [PATCH] dhcp.cgi: Fix for bug #12050
> >> 
> >> Hi,
> >> 
> >>> On 5 Jun 2019, at 12:13, Bernhard Bitsch <Bernhard.Bitsch@gmx.de> wrote:
> >>> 
> >>> Hello,
> >>> 
> >>> Thanks for the merge.
> >>> 
> >>>> Gesendet: Mittwoch, 05. Juni 2019 um 11:05 Uhr
> >>>> Von: "Michael Tremer" <michael.tremer@ipfire.org>
> >>>> An: "Bernhard Bitsch" <Bernhard.Bitsch@gmx.de>
> >>>> Cc: "IPFire Development" <development@lists.ipfire.org>
> >>>> Betreff: Re: [PATCH] dhcp.cgi: Fix for bug #12050
> >>>> 
> >>>> Hello,
> >>>> 
> >>>> I merged this patch.
> >>>> 
> >>>> I had to spend a little time to figure out what you actually wanted to achieve here. It would have helped to add to the commit message that the expected behaviour just wasn’t programmed into the file and that this patch now changes that.
> >>>> 
> >>> 
> >>> The commit message just describes what has changed. The new entry is just added to the file.
> >>> It is not the "one-click-solution" I would prefer, too.
> >>> I can submit a patch for this functionality, if we want to do it this way.
> >> 
> >> I tested the patch and I could add an extra from the fixed list with one click.
> >> 
> >> What are you referring to?
> >> 
> > 
> > Okay it is a mix-up. For editing the new entry is added to the fixed leases list. Thus if I skip the edit step, the entry is contained anyway, but it is not sorted in.
> > A one-click-solution should add the new entry, sort the list and return to default state of the page.
> 
> This is intentional that the page remains in edit mode. People usually want to change the remark or hostname. If you have a list of 200 leases, then finding the one that you have just added can be a pain. That is why this is there.
>

You can set these fields with the first addition operation. No need to make it easy editable in all cases. But the actual solution leaves a somehow irritating state: data is displayed in the edit fields, top entry ( the entry just added ) is in yellow; "is the entry added or must I click 'update' to accomplish this?"
I'm talking of adding new fixed leases, not about adding dynamic leases to the fixed leases set. That's another case, where you should edit the data to separate the IP ranges for these sets.

> > 
> >>> 
> >>>> I updated the commit message for your future reference. Please read through that and take some inspiration from that with your next patch.
> >>>> 
> >>> I've read your message. If the patch contained this functionality I would have stated that in this way.
> >> 
> >> What does the patch do from your point of view?
> >> 
> > 
> > It only synchronises the internal fixed leases list and the fixed leases file, without synching the sort order. 
> 
> Is that a problem when they are not sorted? By what would it be best to sort them? I do not think that the MAC address is a good option. Finding something in there is impossible as soon as the list becomes large.

File fixedleases is sorted by the setting 'SORT_FLEASES' from setttings. This is true for the internal array in dhcp.cgi, also.

> 
> > 
> >>> 
> >>>> I am happy that we can finally close this bug.
> >>>> 
> >>> So am I.
> >>> 
> >>> Best,
> >>> Bernhard
> >>> 
> >>>> Best,
> >>>> -Michael
> >>>> 
> >>>>> On 4 Jun 2019, at 11:24, Bernhard Bitsch <Bernhard.Bitsch@gmx.de> wrote:
> >>>>> 
> >>>>> Save fixed leases to file after addition of a new lease
> >>>>> 
> >>>>> Signed-off-by: Bernhard Bitsch <bbitsch@ipfire.org>
> >>>>> 
> >>>>> ---
> >>>>> html/cgi-bin/dhcp.cgi | 3 +++
> >>>>> 1 file changed, 3 insertions(+)
> >>>>> 
> >>>>> diff --git a/html/cgi-bin/dhcp.cgi b/html/cgi-bin/dhcp.cgi
> >>>>> index 675d80012..19c55eb6d 100644
> >>>>> --- a/html/cgi-bin/dhcp.cgi
> >>>>> +++ b/html/cgi-bin/dhcp.cgi
> >>>>> @@ -443,6 +443,9 @@ if ($dhcpsettings{'ACTION'} eq $Lang::tr{'add'}.'2') {
> >>>>> 	$dhcpsettings{'FIX_ROOTPATH'} = &Header::cleanhtml($dhcpsettings{'FIX_ROOTPATH'});
> >>>>> 	if ($dhcpsettings{'KEY2'} eq '') { #add or edit ?
> >>>>> 	    unshift (@current2, "$dhcpsettings{'FIX_MAC'},$dhcpsettings{'FIX_ADDR'},$dhcpsettings{'FIX_ENABLED'},$dhcpsettings{'FIX_NEXTADDR'},$dhcpsettings{'FIX_FILENAME'},$dhcpsettings{'FIX_ROOTPATH'},$dhcpsettings{'FIX_REMARK'}\n");
> >>>>> +	    open(FILE, ">$filename2") or die 'Unable to open fixed lease file.';
> >>>>> +	    print FILE @current2;
> >>>>> +	    close(FILE);
> >>>>> 	    &General::log($Lang::tr{'fixed ip lease added'});
> >>>>> 
> >>>>> 	    # Enter edit mode
> >>>>> --
> >>>>> 2.21.0.windows.1
> 
>
  

Patch

diff --git a/html/cgi-bin/dhcp.cgi b/html/cgi-bin/dhcp.cgi
index 675d80012..19c55eb6d 100644
--- a/html/cgi-bin/dhcp.cgi
+++ b/html/cgi-bin/dhcp.cgi
@@ -443,6 +443,9 @@  if ($dhcpsettings{'ACTION'} eq $Lang::tr{'add'}.'2') {
 	$dhcpsettings{'FIX_ROOTPATH'} = &Header::cleanhtml($dhcpsettings{'FIX_ROOTPATH'});
 	if ($dhcpsettings{'KEY2'} eq '') { #add or edit ?
 	    unshift (@current2, "$dhcpsettings{'FIX_MAC'},$dhcpsettings{'FIX_ADDR'},$dhcpsettings{'FIX_ENABLED'},$dhcpsettings{'FIX_NEXTADDR'},$dhcpsettings{'FIX_FILENAME'},$dhcpsettings{'FIX_ROOTPATH'},$dhcpsettings{'FIX_REMARK'}\n");
+	    open(FILE, ">$filename2") or die 'Unable to open fixed lease file.';
+	    print FILE @current2;
+	    close(FILE);
 	    &General::log($Lang::tr{'fixed ip lease added'});

 	    # Enter edit mode