bash expr problem/bug... 0$val
Configuration Information [Automatically generated, do not change]: Machine: i386 OS: linux-gnu Compiler: gcc Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='i386' -DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='i386-pc-linux-gnu' -DCONF_VENDOR='pc' -DSHELL -DHAVE_CONFIG_H -I. -I../bash -I../bash/include -I../bash/lib -g -O2 uname output: Linux trzcianka.eu.org 2.4.31-grpom #1 ¶ro cze 15 00:42:24 CEST 2005 i686 GNU/Linux Machine Type: i386-pc-linux-gnu Bash Version: 2.05b Patch Level: 0 Release Status: release Description: bash-expr problems... if a=500 i expect "c: 500", but produce 320 if a="z" i expect "c: 0", but produce 40 etc. (for example in zsh wvwerything works fine...:( ) What's wrong? Why 0 (zero) make a problems? Bug? Repeat-By: # a=500; b="0$[a]"; c=$[b]; echo -e "a: $a\nb: $b\nc: $c\n" a: 500 b: 0500 c: 320 # a=50; b="0$[a]"; c=$[b]; echo -e "a: $a\nb: $b\nc: $c\n" a: 50 b: 050 c: 40 # a="z"; b="0$[a]"; c=$[b]; echo -e "a: $a\nb: $b\nc: $c\n" a: z b: 00 c: 0 # last example produces correct (for me) behaviour... ;) -- eof ___ Bug-bash mailing list Bug-bash@gnu.org http://lists.gnu.org/mailman/listinfo/bug-bash
Re: bash expr problem/bug... 0$val
[EMAIL PROTECTED] wrote: > # a=500; b="0$[a]"; c=$[b]; echo -e "a: $a\nb: $b\nc: $c\n" > a: 500 > b: 0500 > c: 320 man bash, under ARITHMETIC EVALUATION: Constants with a leading 0 are interpreted as octal numbers. paul ___ Bug-bash mailing list Bug-bash@gnu.org http://lists.gnu.org/mailman/listinfo/bug-bash
Re: bash expr problem/bug... 0$val
On Fri, 19 Aug 2005, [EMAIL PROTECTED] wrote: Description: bash-expr problems... if a=500 i expect "c: 500", but produce 320 if a="z" i expect "c: 0", but produce 40 [...] Repeat-By: # a=500; b="0$[a]"; c=$[b]; echo -e "a: $a\nb: $b\nc: $c\n" [...] c: 320 c = 0500 i.e, octal 500 = 320 decimal # a=50; b="0$[a]"; c=$[b]; echo -e "a: $a\nb: $b\nc: $c\n" [...] c: 40 c = 050 i.e, octal 50 = 40 decimal # a="z"; b="0$[a]"; c=$[b]; echo -e "a: $a\nb: $b\nc: $c\n" [...] c: 0 0 is same in all bases. # last example produces correct (for me) behaviour... ;) Hugh ___ Bug-bash mailing list Bug-bash@gnu.org http://lists.gnu.org/mailman/listinfo/bug-bash
"test -w aquota.user" gives different exit code after quotaon run
Configuration Information [Automatically generated, do not change]: Machine: i386 OS: linux-gnu Compiler: i386-redhat-linux-gcc Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='i386' -DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='i386-redhat-linux-gnu' -DCONF_VENDOR='redhat' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash' -DSHELL -DHAVE_CONFIG_H -I. -I. -I./include -I./lib -D_GNU_SOURCE -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O2 -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -m32 -march=i386 -mtune=pentium4 -fasynchronous-unwind-tables uname output: Linux twinhead.yafrank.homeip.net 2.6.12.3-min3 #1 Sat Aug 6 21:13:43 CST 2005 i686 i686 i386 GNU/Linux Machine Type: i386-redhat-linux-gnu Bash Version: 3.0 Patch Level: 16 Release Status: release Description: A user quota management script recently always aborts in a fc3 server with latest update. Experiment shows that '[ -w /usr/local/aquota.user ]' returns 1 after quotaon run triggers the abortion. The same script used to work fine in early fc3. Enable quota in my fc4 box's /usr/local partition and do following test shows similar behavior: [EMAIL PROTECTED] local]# pwd /usr/local [EMAIL PROTECTED] local]# quotaoff -aup user quota on /usr/local (/dev/hda9) is off [EMAIL PROTECTED] local]# ls -l aquota* -rw--- 1 root root 11264 8月 18 18:36 aquota.user [EMAIL PROTECTED] local]# [ -r aquota.user ] && echo true true [EMAIL PROTECTED] local]# [ -w aquota.user ] && echo true true [EMAIL PROTECTED] local]# quotaon -au [EMAIL PROTECTED] local]# quotaon -aup user quota on /usr/local (/dev/hda9) is on [EMAIL PROTECTED] local]# ls -l aquota* -rw--- 1 root root 11264 8月 18 18:36 aquota.user [EMAIL PROTECTED] local]# [ -w aquota.user ] && echo true [EMAIL PROTECTED] local]# [ -r aquota.user ] && echo true true Why "test -w aquota.user" returns different exit code after quotaon run while ls shows the same permission? Do I make anything wrong here? Repeat-By: Turn on and off quota and compare exit code from "test -w /path/to/mount_point/aquota.user" Send instant messages to your online friends http://uk.messenger.yahoo.com ___ Bug-bash mailing list Bug-bash@gnu.org http://lists.gnu.org/mailman/listinfo/bug-bash