-Fixes remove entries in 'extrahd' via the webinterface for extrahd.cgi file.
Suggested-by: Bernhard Bitsch bbitsch@ipfire.org Signed-off-by: Jon Murphy jon.murphy@ipfire.org --- html/cgi-bin/extrahd.cgi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/html/cgi-bin/extrahd.cgi b/html/cgi-bin/extrahd.cgi index 36c0efc2e..9dd3a0eee 100644 --- a/html/cgi-bin/extrahd.cgi +++ b/html/cgi-bin/extrahd.cgi @@ -103,7 +103,7 @@ END } elsif ($extrahdsettings{'ACTION'} eq $Lang::tr{'delete'}) { - if ( &General::system("/usr/local/bin/extrahdctrl", "umount", "$extrahdsettings{'PATH'}")) { + if ( ! &General::system("/usr/local/bin/extrahdctrl", "umount", "$extrahdsettings{'PATH'}")) { open( FILE, "< $devicefile" ) or die "Unable to read $devicefile"; @tmp = <FILE>; close FILE;
Reviewed-by: Michael Tremer michael.tremer@ipfire.org
The syntax pains me, but this is probably correct :)
On 2 Jun 2023, at 20:01, Jon Murphy jon.murphy@ipfire.org wrote:
-Fixes remove entries in 'extrahd' via the webinterface for extrahd.cgi file.
Suggested-by: Bernhard Bitsch bbitsch@ipfire.org Signed-off-by: Jon Murphy jon.murphy@ipfire.org
html/cgi-bin/extrahd.cgi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/html/cgi-bin/extrahd.cgi b/html/cgi-bin/extrahd.cgi index 36c0efc2e..9dd3a0eee 100644 --- a/html/cgi-bin/extrahd.cgi +++ b/html/cgi-bin/extrahd.cgi @@ -103,7 +103,7 @@ END } elsif ($extrahdsettings{'ACTION'} eq $Lang::tr{'delete'}) {
- if ( &General::system("/usr/local/bin/extrahdctrl", "umount", "$extrahdsettings{'PATH'}")) {
- if ( ! &General::system("/usr/local/bin/extrahdctrl", "umount", "$extrahdsettings{'PATH'}")) {
open( FILE, "< $devicefile" ) or die "Unable to read $devicefile"; @tmp = <FILE>; close FILE; -- 2.30.2
Would flipping it around hurt less?
(I’d don’t speak perl but I think this would work!)
``` if ( &General::system("/usr/local/bin/extrahdctrl", "umount", "$extrahdsettings{'PATH'}")) { $errormessage = "$Lang::tr{'extrahd cant umount'} $extrahdsettings{'PATH'}$Lang::tr{'extrahd maybe the device is in use'}?"; } else { open( FILE, "< $devicefile" ) or die "Unable to read $devicefile"; @tmp = <FILE>; close FILE; open( FILE, "> $devicefile" ) or die "Unable to write $devicefile"; foreach $deviceentry (sort @tmp) { @tmpline = split( /;/, $deviceentry ); if ( $tmpline[2] ne $extrahdsettings{'PATH'} ) { print FILE $deviceentry; } } close FILE; } ```
Jon Murphy jon.murphy@ipfire.org
On Jun 5, 2023, at 5:42 AM, Michael Tremer michael.tremer@ipfire.org wrote:
Reviewed-by: Michael Tremer michael.tremer@ipfire.org
The syntax pains me, but this is probably correct :)
On 2 Jun 2023, at 20:01, Jon Murphy jon.murphy@ipfire.org wrote:
-Fixes remove entries in 'extrahd' via the webinterface for extrahd.cgi file.
Suggested-by: Bernhard Bitsch bbitsch@ipfire.org Signed-off-by: Jon Murphy jon.murphy@ipfire.org
html/cgi-bin/extrahd.cgi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/html/cgi-bin/extrahd.cgi b/html/cgi-bin/extrahd.cgi index 36c0efc2e..9dd3a0eee 100644 --- a/html/cgi-bin/extrahd.cgi +++ b/html/cgi-bin/extrahd.cgi @@ -103,7 +103,7 @@ END } elsif ($extrahdsettings{'ACTION'} eq $Lang::tr{'delete'}) {
- if ( &General::system("/usr/local/bin/extrahdctrl", "umount", "$extrahdsettings{'PATH'}")) {
- if ( ! &General::system("/usr/local/bin/extrahdctrl", "umount", "$extrahdsettings{'PATH'}")) {
open( FILE, "< $devicefile" ) or die "Unable to read $devicefile"; @tmp = <FILE>; close FILE; -- 2.30.2
Hello Jon,
On 5 Jun 2023, at 17:53, jon jon.murphy@ipfire.org wrote:
Would flipping it around hurt less?
(I’d don’t speak perl but I think this would work!)
Oh no this wasn’t targeted at the code, just at Perl in general. I don’t find it obvious to read this at all, but there is no way to write this in an absolute intuitive way.
So I am happy to have this merged as it is. The most important thing is that it does the right thing.
-Michael
if ( &General::system("/usr/local/bin/extrahdctrl", "umount", "$extrahdsettings{'PATH'}")) { $errormessage = "$Lang::tr{'extrahd cant umount'} $extrahdsettings{'PATH'}$Lang::tr{'extrahd maybe the device is in use'}?"; } else { open( FILE, "< $devicefile" ) or die "Unable to read $devicefile"; @tmp = <FILE>; close FILE; open( FILE, "> $devicefile" ) or die "Unable to write $devicefile"; foreach $deviceentry (sort @tmp) { @tmpline = split( /\;/, $deviceentry ); if ( $tmpline[2] ne $extrahdsettings{'PATH'} ) { print FILE $deviceentry; } } close FILE; }
Jon Murphy jon.murphy@ipfire.org
On Jun 5, 2023, at 5:42 AM, Michael Tremer michael.tremer@ipfire.org wrote:
Reviewed-by: Michael Tremer michael.tremer@ipfire.org
The syntax pains me, but this is probably correct :)
On 2 Jun 2023, at 20:01, Jon Murphy jon.murphy@ipfire.org wrote:
-Fixes remove entries in 'extrahd' via the webinterface for extrahd.cgi file.
Suggested-by: Bernhard Bitsch bbitsch@ipfire.org Signed-off-by: Jon Murphy jon.murphy@ipfire.org
html/cgi-bin/extrahd.cgi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/html/cgi-bin/extrahd.cgi b/html/cgi-bin/extrahd.cgi index 36c0efc2e..9dd3a0eee 100644 --- a/html/cgi-bin/extrahd.cgi +++ b/html/cgi-bin/extrahd.cgi @@ -103,7 +103,7 @@ END } elsif ($extrahdsettings{'ACTION'} eq $Lang::tr{'delete'}) {
- if ( &General::system("/usr/local/bin/extrahdctrl", "umount", "$extrahdsettings{'PATH'}")) {
- if ( ! &General::system("/usr/local/bin/extrahdctrl", "umount", "$extrahdsettings{'PATH'}")) {
open( FILE, "< $devicefile" ) or die "Unable to read $devicefile"; @tmp = <FILE>; close FILE; -- 2.30.2
Reviewed-by: Bernhard Bitsch bbitsch@ipfire.org
Less painful syntax could be: + unless ( &General::system("/usr/loca/bin/extrahdctrl","umount",$extrahdsettings{'PATH'}")) { Am 02.06.2023 um 21:01 schrieb Jon Murphy:
-Fixes remove entries in 'extrahd' via the webinterface for extrahd.cgi file.
Suggested-by: Bernhard Bitsch bbitsch@ipfire.org Signed-off-by: Jon Murphy jon.murphy@ipfire.org
html/cgi-bin/extrahd.cgi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/html/cgi-bin/extrahd.cgi b/html/cgi-bin/extrahd.cgi index 36c0efc2e..9dd3a0eee 100644 --- a/html/cgi-bin/extrahd.cgi +++ b/html/cgi-bin/extrahd.cgi @@ -103,7 +103,7 @@ END } elsif ($extrahdsettings{'ACTION'} eq $Lang::tr{'delete'}) {
- if ( &General::system("/usr/local/bin/extrahdctrl", "umount", "$extrahdsettings{'PATH'}")) {
- if ( ! &General::system("/usr/local/bin/extrahdctrl", "umount", "$extrahdsettings{'PATH'}")) { open( FILE, "< $devicefile" ) or die "Unable to read $devicefile"; @tmp = <FILE>; close FILE;