Re: Bug in shell: buffer overflow.
2010-12-31, 11:33(-07), Bob Proulx: [...] > Your expressions above are overflowing the value of your system's > maximum integer size. You can read the system's maximum integer size > using getconf. > > $ getconf INT_MAX > 2147483647 [...] POSIX requires that arithmetic expansion be using at least signed longs, so getconf INT_MAX wouldn't necessarily be correct. -- Stephane
assertion botched
Configuration Information [Automatically generated, do not change]: Machine: i486 OS: linux-gnu Compiler: gcc Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='i486' -DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='i486-pc-linux-gnu' -DCONF_VENDOR='pc' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash' -DSHELL -DHAVE_CONFIG_H -I. -I../bash -I../bash/include -I../bash/lib -g -O2 -Wall uname output: Linux rama 2.6.32.14tigrerouge-dom0 #1 SMP Sun May 30 23:23:49 CEST 2010 i686 GNU/Linux Machine Type: i486-pc-linux-gnu Bash Version: 3.2 Patch Level: 39 Release Status: release Description: After running a script which waits for a long while, bash exits with the following message: malloc: ../bash/dispose_cmd.c:241: assertion botched free: underflow detected; mh_nbytes out of range Aborting...Abandon Repeat-By: Run the following piece of code (my code is a repetition of the following sequence) for i in /var/www/boris/wordpress/wp-content/generated-factory/montan/Textures/*.png; do # there we replace all textures with the one we want FILENAME=$(basename $i) mkdir -p "/var/www/boris/wordpress/wp-content/generated-factory/montan/Textures" ln -sf "/var/www/boris/wordpress/wp-content/generated-factory/textures/000DEF.png" "/var/www/boris/wordpress/wp-content/generated-factory/montan/Textures/$FILENAME"; done ln -sf "/var/www/boris/wordpress/wp-content/generated-factory/textures/000DEF.png" "/var/www/boris/wordpress/wp-content/generated-factory/montan/Textures/ModelTexture.png"; echo Triggering render; mkdir -p "/var/www/boris/wordpress/wp-content/generated-factory/montan/CameraFront/neckborder"; chmod 777 "/var/www/boris/wordpress/wp-content/generated-factory/montan/CameraFront/neckborder"; echo 'if not exist C:\3Dboris\montan\neckborder.max goto output' > "/var/www/boris/wordpress/wp-content/generated-factory/montan/action.bat" echo 'C:' >> "/var/www/boris/wordpress/wp-content/generated-factory/montan/action.bat" echo 'cd \3DBoris' >> "/var/www/boris/wordpress/wp-content/generated-factory/montan/action.bat" echo 'copy /Y H:\montan\Textures\ModelTexture.png C:\3Dboris\Texture.png' >> "/var/www/boris/wordpress/wp-content/generated-factory/montan/action.bat" echo 'C:\ImageMagick\montage.exe C:\3Dboris\Texture.png C:\3Dboris\Texture.png C:\3Dboris\Texture.png C:\3Dboris\Texture.png -mode Concatenate -tile 2x2 C:\3Dboris\BiggerTexture.png' >> "/var/www/boris/wordpress/wp-content/generated-factory/montan/action.bat" #echo 'C:\ImageMagick\montage.exe C:\3Dboris\BigTexture.png C:\3Dboris\BigTexture.png C:\3Dboris\BigTexture.png C:\3Dboris\BigTexture.png -mode Concatenate -tile 2x2 C:\3Dboris\BiggerTexture.png' >> "/var/www/boris/wordpress/wp-content/generated-factory/montan/action.bat" echo 'for %%i In (C:\3Dboris\montan\Textures\*.png) DO copy /Y C:\3Dboris\BiggerTexture.png "%%i"' >> "/var/www/boris/wordpress/wp-content/generated-factory/montan/action.bat" echo 'C:\Autodesk\3DS\3dsmaxcmd.exe C:\3Dboris\montan\neckborder.max -o=H:\montan\CameraFront\neckborder\000DEF.png -w 800 -h 600 -camera:CameraFront' >> "/var/www/boris/wordpress/wp-content/generated-factory/montan/action.bat" echo 'H:' >> "/var/www/boris/wordpress/wp-content/generated-factory/montan/action.bat" echo 'cd H:\montan\CameraFront\neckborder' >> "/var/www/boris/wordpress/wp-content/generated-factory/montan/action.bat" echo 'rename H:\montan\CameraFront\neckborder\000DEF.png 000DEF.png' >> "/var/www/boris/wordpress/wp-content/generated-factory/montan/action.bat"; echo ':output' >> "/var/www/boris/wordpress/wp-content/generated-factory/montan/action.bat" echo 'echo "Got out"' >> "/var/www/boris/wordpress/wp-content/generated-factory/montan/action.bat" unix2dos "/var/www/boris/wordpress/wp-content/generated-factory/montan/action.bat" touch "/var/www/boris/wordpress/wp-content/generated-factory/montan/LetsGo.txt" chmod 777 "/var/www/boris/wordpress/wp-content/generated-factory/montan/LetsGo.txt"; echo Triggered render montan CameraFront 000DEF.png; while [ ! -f /var/www/boris/wordpress/wp-content/generated-factory/montan/LetsGo.txt ]; do echo -n '.' ; sleep 1; done; while [ -f /var/www/boris/wordpress/wp-content/generated-factory/montan/LetsGo.txt ] ; do sleep 1; echo -n '.'; done; # rendering with file /var/www/boris/wordpress/wp-content/generated-factory/montan/LetsGo.txt existing. After a long while (I let it run overnight so that counts for several thousands seconds) it will die with the message i quoted. FWIW this script is not run by a regular user but by www-data.
Re: Bug in shell: buffer overflow.
Stephane CHAZELAS wrote: > Bob Proulx wrote: > [...] > > Your expressions above are overflowing the value of your system's > > maximum integer size. You can read the system's maximum integer size > > using getconf. > > > > $ getconf INT_MAX > > 2147483647 > [...] > > POSIX requires that arithmetic expansion be using at least > signed longs, so getconf INT_MAX wouldn't necessarily be > correct. Ah... I didn't know that. Thank you for that correction. Unfortunately LONG_MAX is not available from getconf. But on my system in limits.h LONG_MAX is defined as 9223372036854775807 and the at least one of the previous example calculations was: echo $((72057594037927936*128)) which according to bc works out to be: 9223372036854775808 Bob
Re: Bug in shell: buffer overflow.
On my 32-bit system in Bash: $ printf '%u\n' -1 18446744073709551615 $ echo $((2**63-1)) 9223372036854775807 $ echo $((2**63)) -9223372036854775808 On Sat, Jan 1, 2011 at 11:48 AM, Stephane CHAZELAS wrote: > 2010-12-31, 11:33(-07), Bob Proulx: > [...] >> Your expressions above are overflowing the value of your system's >> maximum integer size. You can read the system's maximum integer size >> using getconf. >> >> $ getconf INT_MAX >> 2147483647 > [...] > > POSIX requires that arithmetic expansion be using at least > signed longs, so getconf INT_MAX wouldn't necessarily be > correct. > > -- > Stephane >
Re: assertion botched
On Mon, Dec 27, 2010 at 6:17 AM, chloe wrote: > Configuration Information [Automatically generated, do not change]: > Machine: i486 > OS: linux-gnu > Compiler: gcc > Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='i486' > -DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='i486-pc-linux-gnu' > -DCONF_VENDOR='pc' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash' -DSHELL > -DHAVE_CONFIG_H -I. -I../bash -I../bash/include -I../bash/lib -g -O2 > -Wall > uname output: Linux rama 2.6.32.14tigrerouge-dom0 #1 SMP Sun May 30 23:23:49 > CEST 2010 i686 GNU/Linux > Machine Type: i486-pc-linux-gnu > > Bash Version: 3.2 > Patch Level: 39 > Release Status: release > > Description: > After running a script which waits for a long while, bash exits with > the following message: > malloc: ../bash/dispose_cmd.c:241: assertion botched > free: underflow detected; mh_nbytes out of range > Aborting...Abandon > > Repeat-By: > Run the following piece of code (my code is a repetition of the > following sequence) > for i in > /var/www/boris/wordpress/wp-content/generated-factory/montan/Textures/*.png; > do > # there we replace all textures with the one we want > FILENAME=$(basename $i) > mkdir -p > "/var/www/boris/wordpress/wp-content/generated-factory/montan/Textures" > ln -sf > "/var/www/boris/wordpress/wp-content/generated-factory/textures/000DEF.png" > "/var/www/boris/wordpress/wp-content/generated-factory/montan/Textures/$FILENAME"; > done > ln -sf > "/var/www/boris/wordpress/wp-content/generated-factory/textures/000DEF.png" > "/var/www/boris/wordpress/wp-content/generated-factory/montan/Textures/ModelTexture.png"; > echo Triggering render; > mkdir -p > "/var/www/boris/wordpress/wp-content/generated-factory/montan/CameraFront/neckborder"; > chmod 777 > "/var/www/boris/wordpress/wp-content/generated-factory/montan/CameraFront/neckborder"; > echo 'if not exist C:\3Dboris\montan\neckborder.max goto output' > > "/var/www/boris/wordpress/wp-content/generated-factory/montan/action.bat" > echo 'C:' >> > "/var/www/boris/wordpress/wp-content/generated-factory/montan/action.bat" > echo 'cd \3DBoris' >> > "/var/www/boris/wordpress/wp-content/generated-factory/montan/action.bat" > echo 'copy /Y H:\montan\Textures\ModelTexture.png C:\3Dboris\Texture.png' >> > "/var/www/boris/wordpress/wp-content/generated-factory/montan/action.bat" > echo 'C:\ImageMagick\montage.exe C:\3Dboris\Texture.png > C:\3Dboris\Texture.png C:\3Dboris\Texture.png C:\3Dboris\Texture.png -mode > Concatenate -tile 2x2 C:\3Dboris\BiggerTexture.png' >> > "/var/www/boris/wordpress/wp-content/generated-factory/montan/action.bat" > #echo 'C:\ImageMagick\montage.exe C:\3Dboris\BigTexture.png > C:\3Dboris\BigTexture.png C:\3Dboris\BigTexture.png C:\3Dboris\BigTexture.png > -mode Concatenate -tile 2x2 C:\3Dboris\BiggerTexture.png' >> > "/var/www/boris/wordpress/wp-content/generated-factory/montan/action.bat" > echo 'for %%i In (C:\3Dboris\montan\Textures\*.png) DO copy /Y > C:\3Dboris\BiggerTexture.png "%%i"' >> > "/var/www/boris/wordpress/wp-content/generated-factory/montan/action.bat" > echo 'C:\Autodesk\3DS\3dsmaxcmd.exe C:\3Dboris\montan\neckborder.max > -o=H:\montan\CameraFront\neckborder\000DEF.png -w 800 -h 600 > -camera:CameraFront' >> > "/var/www/boris/wordpress/wp-content/generated-factory/montan/action.bat" > echo 'H:' >> > "/var/www/boris/wordpress/wp-content/generated-factory/montan/action.bat" > echo 'cd H:\montan\CameraFront\neckborder' >> > "/var/www/boris/wordpress/wp-content/generated-factory/montan/action.bat" > echo 'rename H:\montan\CameraFront\neckborder\000DEF.png 000DEF.png' >> > "/var/www/boris/wordpress/wp-content/generated-factory/montan/action.bat"; > echo ':output' >> > "/var/www/boris/wordpress/wp-content/generated-factory/montan/action.bat" > echo 'echo "Got out"' >> > "/var/www/boris/wordpress/wp-content/generated-factory/montan/action.bat" > unix2dos > "/var/www/boris/wordpress/wp-content/generated-factory/montan/action.bat" > touch > "/var/www/boris/wordpress/wp-content/generated-factory/montan/LetsGo.txt" > chmod 777 > "/var/www/boris/wordpress/wp-content/generated-factory/montan/LetsGo.txt"; > echo Triggered render montan CameraFront 000DEF.png; > while [ ! -f > /var/www/boris/wordpress/wp-content/generated-factory/montan/LetsGo.txt ]; do > echo -n '.' ; sleep 1; done; > while [ -f > /var/www/boris/wordpress/wp-content/generated-factory/montan/LetsGo.txt ] ; > do sleep 1; echo -n '.'; done; # rendering > > with file > /var/www/boris/wordpress/wp-content/generated-factory/montan/LetsGo.txt > existing. > > After a long while (I let it run overnight so that counts for several > thousands seconds) it will die with the message i quoted. > > FWIW this script is not run by a regular user but by www-data. > > tl;dr Seriously, use a variable and cut out all that repetition: base="/var/www/boris/wordpress/wp-content/generated-factory/montan" for i in "$base/Textures/"*.png; do # t
Re: Command substitution (backtick) and tab completion
On 12/31/10 11:01 PM, Sven Mascheck wrote: > On Fri, Dec 31, 2010 at 12:20:38PM -0800, chengiz wrote: >> On Dec 31, 12:20 pm, Sven Mascheck wrote: > >>> (see also http://lists.gnu.org/archive/html/bug-bash/2008-01/msg00049.html) >>> [...] >> >> I dont see how that's related - I dont doubt you that the fix to this >> issue "broke" my example, but in that case there's premature >> execution, in my case the ticks are closed. [...] > > Here's how I understood it: > The original problem was just the trigger. The decision was to completely > disable command substitution while the completion system is active here. > That's why I posted the bug report link: just see the reply from Chet. The idea is that it's not safe, in general, to run arbitrary command substitutions more than once. They may have side effects. Chet -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita brevis'' - Hippocrates Chet Ramey, ITS, CWRUc...@case.eduhttp://cnswww.cns.cwru.edu/~chet/