Re: date +%s ignores TZ
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 According to Jan Engelhardt on 3/1/2008 6:40 PM: | | $(()) is easily confusable with $(), I therefore ask $[] to be not removed, | more like the reverse actually. Unfortunately, $(()) is standardized by POSIX, $[] is not. And this is the wrong list to ask, since coreutils does not maintain the shell. - -- Don't work too hard, make some time for fun as well! Eric Blake [EMAIL PROTECTED] -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.5 (Cygwin) Comment: Public key at home.comcast.net/~ericblake/eblake.gpg Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFHyhRa84KuGfSFAYARAnG4AKCjM1J1rYK+L6lALYTsMMeE5kx14ACfauPS yyGaPGZE8i3nl7IBhwTN0GY= =KBkr -END PGP SIGNATURE- ___ Bug-coreutils mailing list Bug-coreutils@gnu.org http://lists.gnu.org/mailman/listinfo/bug-coreutils
Re: date +%s ignores TZ
Jan Engelhardt wrote: > $(()) is easily confusable with $(), I therefore ask $[] to be not removed, > more like the reverse actually. I am not able to influence the decision. I am just reporting how it is documented. Bob ___ Bug-coreutils mailing list Bug-coreutils@gnu.org http://lists.gnu.org/mailman/listinfo/bug-coreutils
Re: date +%s ignores TZ
On Feb 29 2008 15:26, Bob Proulx wrote: >> >> echo $[`date +%s` % 86400]; > >Note that the $[expression] syntax is deprecated and is scheduled for >removal from a future version of the shell. Please convert to using >the now standard $((expression)) syntax. > > echo $(( $(date +%s) % 86400 )); $(()) is easily confusable with $(), I therefore ask $[] to be not removed, more like the reverse actually. ___ Bug-coreutils mailing list Bug-coreutils@gnu.org http://lists.gnu.org/mailman/listinfo/bug-coreutils
Re: Hide command line arguments
Martin Bernreuther wrote: > on a common Linux system, everyone can use e.g. > ps and will see running processes of all users including > the command line arguments. Yes. This is a long standing reason that programs that deal with secure data such as passwords should avoid putting passwords in the argument list, for example. > I'd like to hide the command line arguments e.g. for the cp command, > which sometimes uses quite a long time to copy large files, to keep > the path and file names secret. I suggest using the 'rsync --from0 --files-from=FILE' options. This will read a list of files (optionally from stdin if FILE is "-") and therefore the filenames will never appear in the argument list of the process. Another alternative is to use the 'cp -R' to copy a directory of files. In that case cp reads the directory listing itself and therefore the filenames are never in the argument list. > Writing a small C program, it's quite easy to > overwrite all chars of the argv[] strings with 0 > after the commandline options are being processed. > > Is there a possibility to activate such a feature > in e.g. cp? (like cp --hideargs ...) Unfortunately that doesn't really work. If a ps is done very quickly after the program starts but before it can obscure the argument list then the values are still seen. It reduces the time that arguments are exposed but this creates a false sense of security. This false sense of security may be worse because it would lead people to believe they are safe when they are not. If you really need to hide the files then it is better to solve the problem 100% and _never_ put the filename in the argument list. That means that the list of files needs to read by the program by other means. Either by having the program read the directory itself or by passing it a list through the environment or by passing it a list by file. The rsync command seems perfectly fitted to this task. Although I will admit that sending the list of files to copy to it through a file/stdin is slightly more involved than cp. But here since you are wanting more then a little more work to get it seems reasonable. Bob ___ Bug-coreutils mailing list Bug-coreutils@gnu.org http://lists.gnu.org/mailman/listinfo/bug-coreutils
Hide command line arguments
Hello, on a common Linux system, everyone can use e.g. ps and will see running processes of all users including the command line arguments. I'd like to hide the command line arguments e.g. for the cp command, which sometimes uses quite a long time to copy large files, to keep the path and file names secret. Writing a small C program, it's quite easy to overwrite all chars of the argv[] strings with 0 after the commandline options are being processed. Is there a possibility to activate such a feature in e.g. cp? (like cp --hideargs ...) Thanks, Martin -- _ Martin Bernreuther [EMAIL PROTECTED] ___ Bug-coreutils mailing list Bug-coreutils@gnu.org http://lists.gnu.org/mailman/listinfo/bug-coreutils
Re: date +%s ignores TZ
Andreas Schwab wrote: > This will fail during the day after a DST transition. Which points out a terrible bug in my suggestion of how to map the range of 0-(N-1) to the range of 1-N! Bob wrote this buggy code: >> case $secondssincedaystart in (0) secondssincedaystart=86400 ;; esac That will obviously fail miserably at midnight on the day after a dst change. Another reason not to do it! Bob ___ Bug-coreutils mailing list Bug-coreutils@gnu.org http://lists.gnu.org/mailman/listinfo/bug-coreutils
Re: date +%s ignores TZ
Philip Rowlands <[EMAIL PROTECTED]> writes: > I might be misunderstanding the problem, but it seems easy enough to do > this calling date only once: > > $ date +%T | awk -F: '{ print $1 * 3600 + $2 * 60 + $3 }' > 67652 This will fail during the day after a DST transition. Andreas. -- Andreas Schwab, SuSE Labs, [EMAIL PROTECTED] SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany PGP key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 "And now for something completely different." ___ Bug-coreutils mailing list Bug-coreutils@gnu.org http://lists.gnu.org/mailman/listinfo/bug-coreutils
Re: date +%s ignores TZ
On Fri, 29 Feb 2008, Bob Proulx wrote: Jan Engelhardt wrote: I wanted to get the number of seconds since the start of the day. echo $[`date +%s` % 86400]; unfortunately does not do the right thing ÿÿ it would show 82800 instead of 0 when it is (local) midnight. I can't think of any totally race free way to do this without invoking date multiple times. I might be misunderstanding the problem, but it seems easy enough to do this calling date only once: $ date +%T | awk -F: '{ print $1 * 3600 + $2 * 60 + $3 }' 67652 (corresponding to 18:47:32) Cheers, Phil ___ Bug-coreutils mailing list Bug-coreutils@gnu.org http://lists.gnu.org/mailman/listinfo/bug-coreutils