bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Variable passed to system contains garbage characters


From: Patrick Nagelschmidt
Subject: Variable passed to system contains garbage characters
Date: Sun, 16 Dec 2007 02:22:46 +0100

Configuration Information [Automatically generated, do not change]:
Machine: i686
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='i686' -DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='i686-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 -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32 -march=i386 -mtune=generic -fasynchronous-unwind-tables uname output: Linux DL.second 2.6.23.1 #1 Sun Oct 21 17:49:04 CEST 2007 i686 athlon i386 GNU/Linux
Machine Type: i686-redhat-linux-gnu

Bash Version: 3.2
Patch Level: 33
Release Status: release

Description:
        The script below fails on my box with the following output:

        1197676800
        date: invalid date `1970-01-01 \033[?1034h1197676800 sec'

        So for some reason the value passed to date got a nasty prefix.

        I guess this could be charset-related, so here's my locale

        LANG=en_US
        LC_CTYPE="en_US"
        LC_NUMERIC="en_US"
        LC_TIME="en_US"
        LC_COLLATE="en_US"
        LC_MONETARY="en_US"
        LC_MESSAGES="en_US"
        LC_PAPER="en_US"
        LC_NAME="en_US"
        LC_ADDRESS="en_US"
        LC_TELEPHONE="en_US"
        LC_MEASUREMENT="en_US"
        LC_IDENTIFICATION="en_US"
        LC_ALL=

Repeat-By:
        executing this script

        #!/bin/bash
        let "STEP=86400"
        let "CALCTIME=`date +%s`"
export DAYSTART=`echo "$CALCTIME - ($CALCTIME % $STEP) - $STEP" |bc -i |tail -1`
        echo "$DAYSTART"
        export BASHBUG=`date -d "1970-01-01 $DAYSTART sec" +"%Y-%m-%d %T"`

Fix:
        Yes, please ;)





reply via email to

[Prev in Thread] Current Thread [Next in Thread]