[PATCH] [1.2.x] hdparm -S argument parsing broken

Tito farmatito at tiscali.it
Wed Aug 2 16:24:09 UTC 2006


On Wednesday 2 August 2006 11:57, Andre wrote:
> Tito <farmatito at tiscali.it> wrote:
> > On Wednesday 2 August 2006 03:02, Andre wrote:
> > > Somewhere between 1.1.3 and 1.2.0, hdparm argument parsing seems
> > > to have got broken:
> > > 
> > > # busybox
> > > BusyBox v1.2.1 (2006.08.01-11:01+0000) multi-call binary
> > > 
> > > # busybox hdparm -S 180 /dev/hda
> > > hdparm: 180: No such file or directory
> > > 
> > 
> > this is due to the fact that hdparm was ported to getopt for
> > command line parsing. Now if an argument of a command line
> > switch is optional it must follow its switch with no blank
> > space between them:
> > 
> 
> Thanks for the hint !!
> 
> hdparm -S with no arguments doesn't do anything useful with busybox
> and generates a 'missing value' warning with hdparm from debian
> sarge... so this certainly looks like a bug.
> 
> Also noticed that print_flag() does the wrong thing for 'set_standby'
> - it prints value followed by a newline instead of value followed by
> opening bracket.
> 
> # hdparm -S 180 /dev/hda
> 
> /dev/hda:
>  setting standby to 180 (15 minutes)
> 
> # busybox hdparm -S180 /dev/hda
> 
> /dev/hda:
>  setting standby to 180
> 15 minutes + 0 seconds)          <-- should be on previous line
> 
> 
> Andre

Hi, this patch should fix the minor bug in command line  parsing
and the missing ( in the program output.

The patch is trivial and tested.

Please apply.

Ciao,
Tito
-------------- next part --------------
A non-text attachment was scrubbed...
Name: hdparm_S_fix.patch
Type: text/x-diff
Size: 541 bytes
Desc: not available
Url : http://lists.busybox.net/pipermail/busybox/attachments/20060802/592c7936/attachment-0002.bin 


More information about the busybox mailing list