Re: echo -n?
/bin/echo -e \\x2Dn Alas, -e is not guaranteed by POSIX.
Re: echo -n?
A friend came up with this hack `echo -n\ '; note the space. Which is a bit of a cheat. And `echo -e --\\bn', which alas is not POSIXly.
Re: echo -n?
According to Alfred M. Szmidt on 2/15/2010 6:14 AM: >/bin/echo -e \\x2Dn > > Alas, -e is not guaranteed by POSIX. That's the whole point. POSIX _guarantees_ that echo is non-portable with options or with backslash, and that if you want to echo something starting with -n, you must use something other than echo to achieve that effect. -- Don't work too hard, make some time for fun as well! Eric Blake e...@byu.net signature.asc Description: OpenPGP digital signature
Re: [dirname] fix documentation when using on a full directory path
According to Emmanuel Lacour on 2/12/2010 9:05 AM: > but documentation say: > > dirname - strip non-directory suffix from file name Thanks for the report. Both the man page and the texinfo could use the improvement. I'm installing this: -- Don't work too hard, make some time for fun as well! Eric Blake e...@byu.net From ad205b9a9b1c77ac83f3418a8063a5086abd375b Mon Sep 17 00:00:00 2001 From: Eric Blake Date: Mon, 15 Feb 2010 06:45:31 -0700 Subject: [PATCH] dirname: improve man page description * doc/coreutils.texi (dirname invocation): Properly cover behavior on directory. * man/dirname.x: Likewise. * THANKS: Update. Reported by Emmanuel Lacour. --- doc/coreutils.texi | 10 +- man/dirname.x |2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/doc/coreutils.texi b/doc/coreutils.texi index e3e95f5..94c493a 100644 --- a/doc/coreutils.texi +++ b/doc/coreutils.texi @@ -53,7 +53,7 @@ * df: (coreutils)df invocation. Report file system disk usage. * dir: (coreutils)dir invocation. List directories briefly. * dircolors: (coreutils)dircolors invocation. Color setup for ls. -* dirname: (coreutils)dirname invocation. Strip non-directory suffix. +* dirname: (coreutils)dirname invocation. Strip last file component. * du: (coreutils)du invocation. Report on disk usage. * echo: (coreutils)echo invocation. Print a line of text. * env: (coreutils)env invocation. Modify the environment. @@ -377,7 +377,7 @@ Top File name manipulation * basename invocation:: Strip directory and suffix from a file name -* dirname invocation:: Strip non-directory suffix from a file name +* dirname invocation:: Strip last file name component * pathchk invocation:: Check file name validity and portability * mktemp invocation::Create temporary file or directory @@ -11902,7 +11902,7 @@ File name manipulation @menu * basename invocation:: Strip directory and suffix from a file name. -* dirname invocation:: Strip non-directory suffix from a file name. +* dirname invocation:: Strip last file name component. * pathchk invocation:: Check file name validity and portability. * mktemp invocation:: Create temporary file or directory. @end menu @@ -11963,7 +11963,7 @@ basename invocation @node dirname invocation -...@section @command{dirname}: Strip non-directory suffix from a file name +...@section @command{dirname}: Strip last file name component @pindex dirname @cindex directory components, printing @@ -11971,7 +11971,7 @@ dirname invocation @cindex non-directory suffix, stripping @command{dirname} prints all but the final slash-delimited component of -a string (presumably a file name). Synopsis: +a string (presumably a file name, but also works on directories). Synopsis: @example dirname @var{name} diff --git a/man/dirname.x b/man/dirname.x index 2cfa08a..09c46e4 100644 --- a/man/dirname.x +++ b/man/dirname.x @@ -1,5 +1,5 @@ [NAME] -dirname \- strip non-directory suffix from file name +dirname \- strip last component from file name [DESCRIPTION] .\" Add any additional description here [SEE ALSO] -- 1.6.6.1 signature.asc Description: OpenPGP digital signature
Re: echo -n?
"Alfred M. Szmidt" writes: > A friend came up with this hack `echo -n\ '; note the space. Which is > a bit of a cheat. And `echo -e --\\bn', which alas is not POSIXly. POSIXly correct or not, '--\bn' is not the same as '-n'. Giuseppe
Re: [dirname] fix documentation when using on a full directory path
Eric Blake wrote: > According to Emmanuel Lacour on 2/12/2010 9:05 AM: >> but documentation say: >> >> dirname - strip non-directory suffix from file name > > Thanks for the report. Both the man page and the texinfo could use the > improvement. I'm installing this: Thank you! one suggestion: ... > Subject: [PATCH] dirname: improve man page description > > * doc/coreutils.texi (dirname invocation): Properly cover behavior > on directory. > * man/dirname.x: Likewise. > * THANKS: Update. > Reported by Emmanuel Lacour. > --- > doc/coreutils.texi | 10 +- > man/dirname.x |2 +- > 2 files changed, 6 insertions(+), 6 deletions(-) > > diff --git a/doc/coreutils.texi b/doc/coreutils.texi > index e3e95f5..94c493a 100644 > --- a/doc/coreutils.texi > +++ b/doc/coreutils.texi > @@ -53,7 +53,7 @@ > * df: (coreutils)df invocation. Report file system disk > usage. > * dir: (coreutils)dir invocation. List directories briefly. > * dircolors: (coreutils)dircolors invocation. Color setup for ls. > -* dirname: (coreutils)dirname invocation. Strip non-directory suffix. > +* dirname: (coreutils)dirname invocation. Strip last file component. s/file/file name/ > * du: (coreutils)du invocation. Report on disk usage. > * echo: (coreutils)echo invocation. Print a line of text. > * env: (coreutils)env invocation. Modify the environment. > @@ -377,7 +377,7 @@ Top > File name manipulation > > * basename invocation:: Strip directory and suffix from a file name > -* dirname invocation:: Strip non-directory suffix from a file name > +* dirname invocation:: Strip last file name component ...
Re: [dirname] fix documentation when using on a full directory path
According to Jim Meyering on 2/15/2010 6:52 AM: > Thank you! > one suggestion: > > ... >> -* dirname: (coreutils)dirname invocation. Strip non-directory suffix. >> +* dirname: (coreutils)dirname invocation. Strip last file component. > > s/file/file name/ Done. I also pushed this minor patch: From 7ae60bf26ff6e10f4f514835d859c3a2e35a3d74 Mon Sep 17 00:00:00 2001 From: Eric Blake Date: Mon, 15 Feb 2010 06:56:11 -0700 Subject: [PATCH] build: ignore another gnulib artifact * .gitignore: Add lib/warn-on-use.h. --- .gitignore |1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/.gitignore b/.gitignore index 3075883..15aef4f 100644 --- a/.gitignore +++ b/.gitignore @@ -60,6 +60,7 @@ lib/selinux lib/unistr lib/uniwidth lib/unused-parameter.h +lib/warn-on-use.h m4/.cvsignore m4/.gitignore maint.mk -- 1.6.6.1 -- Don't work too hard, make some time for fun as well! Eric Blake e...@byu.net signature.asc Description: OpenPGP digital signature
Re: [dirname] fix documentation when using on a full directory path
On Mon, Feb 15, 2010 at 06:49:40AM -0700, Eric Blake wrote: > According to Emmanuel Lacour on 2/12/2010 9:05 AM: > > but documentation say: > > > > dirname - strip non-directory suffix from file name > > Thanks for the report. Both the man page and the texinfo could use the > improvement. I'm installing this: > ok to me (with Jim Meyering remark about s/file/file name).
RE: stat
Carlos, > Sorry for this episode. The stat command is from a passcal program > that I have installed and its in the PATH. Oh good. I am glad things could be cleared up! Bob - Message from Carlos Corela - From: Carlos Corela To: Bob Proulx Subject: RE: stat Date: Mon, 15 Feb 2010 15:46:13 + Sorry for this episode. The stat command is from a passcal program that I have installed and its in the PATH. Carlos From: Bob Proulx [...@proulx.com] Sent: Monday, February 15, 2010 6:09 AM To: Carlos Corela Cc: bug-coreutils@gnu.org Subject: Re: stat Carlos Corela wrote: > Each time I invoke the stat command I receive the answer > > Display acquisition status. > USAGE: asts [-l][-f daslist.txt]|[-d das:server][-v] That doesn't look like stat. What is the output of this? $ type stat $ stat --version Bob - End Message -
DATE command
From time to time, I run into a situation where I'd like to know the elapsed time between events. In theory, this is easily accomplished by converting the date/time of both events to seconds since the epoch, then performing several divisions by the appropriate factors. That is, until you run into this kind of weirdness in which "date" groks "CST", "EDT" and "EST" but throws up its hands at the thought of Central Daylight Time. [...@madeleine ~]$ date -d "Dec 21 2004 7:42 AM CDT" +%s date: invalid date `Dec 21 2004 7:42 AM CDT' [...@madeleine ~]$ date -d "Dec 21 2004 7:42 AM CST" +%s 1103636520 [...@madeleine ~]$ date -d "Dec 21 2004 8:42 AM EDT" +%s 1103632920 [...@madeleine ~]$ date -d "Dec 21 2004 8:42 AM EST" +%s 1103636520 [...@madeleine ~]$ This is on a CentOS 5.4 machine, fully updated. [...@madeleine ~]$ rpm -q coreutils coreutils-5.97-23.el5_4.1.i386 My apologies if this has already been fixed upstream.
bug #26512 (C_NORM unused)
Hello all, attached is a patch for bug #26512 http://savannah.gnu.org/bugs/index.php?26512 Is it correct? make distcheck still passes all tests. There's a seemingly useless C_RESET at every end of line, just before the next color sequence at the start of the next line -- but that's the same behaviour as "ls -x" before the patch, so maybe it is needed? Could you please incorporate this into the next release? The change in behaviour was introduced with the following commit. C_NORM was unused since then. commit 483297d5ddaea930d61da1da9c3f052cbd3c3810 Author: Ed Avis Date: Tue Feb 12 12:22:35 2008 +0100 ls --color no longer outputs unnecessary escape sequences In --color mode, plain files do not get any color, not even white. When no highlighting is required, ls outputs no escape sequence at all. * src/ls.c (print_with_color): (used_color): New global. (indicator_no) [C_RESET]: New enum value. (indicator_name) ["rs"]: Corresponding new string. (color_indicator): Make the 'normal' and 'file' markers be NULL. Use "rs" (C_RESET) to reset to ordinary colors. (process_signals): Restore default colors only if necessary. (main): Don't call prep_non_filename_text here. (print_name_with_quoting): Call it here, instead. > (prep_non_filename_text): Use C_RESET, not C_NORM. (print_color_indicator): Return bool, not void. Print nothing, when possible. (put_indicator): Call prep_non_filename_text the first time. * tests/misc/ls-misc: Test for above. * tests/ls/color-dtype-dir: Adapt: no escapes around regular file name. * TODO: Remove item. * NEWS: Mention this. Moritz diff --git a/src/ls.c b/src/ls.c index 680679a..4cfb7c7 100644 --- a/src/ls.c +++ b/src/ls.c @@ -1149,6 +1149,17 @@ restore_default_color (void) put_indicator (&color_indicator[C_RIGHT]); } +static void +set_normal_color (void) +{ + if (color_indicator[C_NORM].string != NULL) + { + put_indicator (&color_indicator[C_LEFT]); + put_indicator (&color_indicator[C_NORM]); + put_indicator (&color_indicator[C_RIGHT]); + } +} + /* An ordinary signal was received; arrange for the program to exit. */ static void @@ -3444,6 +3455,8 @@ print_current_files (void) case long_format: for (i = 0; i < cwd_n_used; i++) { + if (print_with_color) +set_normal_color (); print_long_format (sorted_file[i]); DIRED_PUTCHAR ('\n'); } @@ -4048,6 +4061,9 @@ print_file_name_and_frills (const struct fileinfo *f, size_t start_col) { char buf[MAX (LONGEST_HUMAN_READABLE + 1, INT_BUFSIZE_BOUND (uintmax_t))]; + if (print_with_color) +set_normal_color (); + if (print_inode) printf ("%*s ", format == with_commas ? 0 : inode_number_width, format_inode (buf, sizeof buf, f));
Re: DATE command
Robert wrote: > That is, until you run into this kind of weirdness in which "date" groks > "CST", "EDT" and "EST" but throws up its hands at the thought of Central > Daylight Time. Thank you for the report. But what you are seeing is not a bug in date but is a misunderstanding of when daylight savings time is active in your timezone. DST is valid from April to October and December uses standard time. Therefore your use of DST in December is invalid. You are better off using UTC in all such cases. It avoids problems with DST. You are simply running into a DST problem. Remember, that DST is in place by Act Of Congress. It isn't a technical problem. :-) > [...@madeleine ~]$ date -d "Dec 21 2004 7:42 AM CDT" +%s > date: invalid date `Dec 21 2004 7:42 AM CDT' Right. There is no such time. It is invalid. Date correctly reports this to you. $ zdump -v US/Central | grep '200[45]' US/Central Sun Apr 4 07:59:59 2004 UTC = Sun Apr 4 01:59:59 2004 CST isdst=0 gmtoff=-21600 US/Central Sun Apr 4 08:00:00 2004 UTC = Sun Apr 4 03:00:00 2004 CDT isdst=1 gmtoff=-18000 US/Central Sun Oct 31 06:59:59 2004 UTC = Sun Oct 31 01:59:59 2004 CDT isdst=1 gmtoff=-18000 US/Central Sun Oct 31 07:00:00 2004 UTC = Sun Oct 31 01:00:00 2004 CST isdst=0 gmtoff=-21600 US/Central Sun Apr 3 07:59:59 2005 UTC = Sun Apr 3 01:59:59 2005 CST isdst=0 gmtoff=-21600 US/Central Sun Apr 3 08:00:00 2005 UTC = Sun Apr 3 03:00:00 2005 CDT isdst=1 gmtoff=-18000 US/Central Sun Oct 30 06:59:59 2005 UTC = Sun Oct 30 01:59:59 2005 CDT isdst=1 gmtoff=-18000 US/Central Sun Oct 30 07:00:00 2005 UTC = Sun Oct 30 01:00:00 2005 CST isdst=0 gmtoff=-21600 As you can see CDT is not valid at any time in December. You also see this by experimentation. $ TZ=US/Central date -d "Dec 21 2004 7:42 AM CDT" date: invalid date `Dec 21 2004 7:42 AM CDT' $ TZ=US/Central date -d "Dec 21 2004 7:42 AM CST" Tue Dec 21 07:42:00 CST 2004 Please see this reference for more information. http://www.gnu.org/software/coreutils/faq/#The-date-command-is-not-working-right_002e Bob
Re: Final point in new option of join
On 12/02/10 18:14, Jim Meyering wrote: Pádraig Brady wrote: I've added a syntax-check rule to grep the man pages for --options with descriptions with initial uppercase letters in the attached. Thanks! Subject: [PATCH] doc: fix inconsistent capitalization in --help output ... Looks fine. One minor nit. Rules that run a sub-make should be listed in ALL_RECURSIVE_TARGETS: diff --git a/cfg.mk b/cfg.mk index b5a21c3..dd6da25 100644 --- a/cfg.mk +++ b/cfg.mk @@ -171,6 +171,14 @@ ALL_RECURSIVE_TARGETS += sc_check-AUTHORS sc_check-AUTHORS: @$(MAKE) -C src $@ +# Option descriptions should not start with a capital letter +# One could grep source directly as follows: +# grep -E " {2,6}-.*[^.] [A-Z][a-z]" $$($(VC_LIST_EXCEPT) | grep '\.c$$') +# but that would miss descriptions not on the same line as the -option. ALL_RECURSIVE_TARGETS += sc_option_desc_uppercase You don't miss much :) I noticed that right after sending. +sc_option_desc_uppercase: + @$(MAKE) -C src $@ + @$(MAKE) -C man $@ I've pushed with the above changed to: @$(MAKE) -s -C src all_programs @$(MAKE) -s -C man $@ The -s is defined by POSIX and is available on linux/BSD/solaris at least, and makes the output from `make syntax-check` much cleaner. I might add it to all syntax-check sub makes. cheers, Pádraig.
Re: bug #26512 (C_NORM unused)
On 15/02/10 20:05, Moritz Orbach wrote: Hello all, attached is a patch for bug #26512 http://savannah.gnu.org/bugs/index.php?26512 Is it correct? make distcheck still passes all tests. There's a seemingly useless C_RESET at every end of line, just before the next color sequence at the start of the next line -- but that's the same behaviour as "ls -x" before the patch, so maybe it is needed? Could you please incorporate this into the next release? The change in behaviour was introduced with the following commit. C_NORM was unused since then. commit 483297d5ddaea930d61da1da9c3f052cbd3c3810 Author: Ed Avis Date: Tue Feb 12 12:22:35 2008 +0100 You're right, the following should show bold/bright text: LS_COLORS=no=1 ls -l --color Also, "no" being configurable is alluded to in: dircolors -p | grep NORMAL The patch looks sensible at first glance. I'll test it thoroughly tomorrow morning and check it in. thanks! Pádraig.
Re: Bug#569020: coreutils: failure of install-C test on GNU/kFreeBSD
On 11/02/10 11:00, Pádraig Brady wrote: On 11/02/10 10:29, Pádraig Brady wrote: On 11/02/10 02:14, Michael Stone wrote: FAIL: tail-2/inotify-hash-abuse2 (exit: 1) == tail: `f' has become inaccessible: No such file or directory ./tail-2/inotify-hash-abuse2: line 34: kill: (13733) - No such process ./tail-2/inotify-hash-abuse2: line 40: kill: (13733) - No such process As far as I read the test, there will always be a race where f could be temporarily unavailable between the mv and the touch. I forget what it's supposed to be testing for, but to close that race, I think touch g mv g f would be better, no? That's what we're explicitly trying to trigger. `tail` should not exit in this case as -F is specified (--retry) Perhaps if the box is heavily loaded it can't complete each iteration of the loop within an average of 0.05s (in which case the timeout would kick in), though I'd be surprised if your system could only iterate < 20 times a second. In any case, since the timeout is just here to ensure no tail's are left running if the test is canceled, it's probably better to explicitly clean up as in this patch. Could you try and reproduce with this? --- a/tests/tail-2/inotify-hash-abuse2 +++ b/tests/tail-2/inotify-hash-abuse2 @@ -28,7 +28,8 @@ touch f || framework_failure debug='---disable-inotify -s .001' debug= -timeout 10 tail $debug -F f & pid=$! +tail $debug -F f & pid=$! +cleanup_() { kill $pid; } for i in $(seq 200); do kill -0 $pid || break; I've pushed the above without waiting for feedback as even if it has nothing to do with the failure, it's more robust I think. cheers, Pádraig.
Re: Final point in new option of join
On 12/02/10 18:11, Jim Meyering wrote: Pádraig Brady wrote: I was also wondering about calling "check-programs-vs-x" from syntax-check instead of dist-check? Thanks for pointing that out! I've just looked it up in the automake documentation, and see that a distcheck-hook rule is recognized only if it's in the top-level directory. The attached patch now calls these tests as part of syntax-check cheers, Pádraig. >From 6f3103fbf2f390137dcc147e3bd3b322af906073 Mon Sep 17 00:00:00 2001 From: =?utf-8?q?P=C3=A1draig=20Brady?= Date: Fri, 12 Feb 2010 18:34:33 + Subject: [PATCH] maint: fix the man page correlation tests These checks were not being run as distcheck-hook targets are only supported in the top-level Makefile. Instead these tests are now run during a syntax-check. * cfg.mk (sc_man_file_correlation): A new syntax check to call the 2 existing tests to check the correlation between the programs and man/*.[1x]. * man/Makefile.am (sc_man_file_correlation): Call the 2 existing man page correlation tests. (check-x-vs-1): Be quiet by not outputting the "GEN" annotation. (check-programs-vs-x): Likewise. * src/Makefile.am (all_programs.list): Exclude libstdbuf.so from the list of programs. This issue was not noticed as the checks were not actually being run. --- cfg.mk |5 + man/Makefile.am |7 --- src/Makefile.am |1 + 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/cfg.mk b/cfg.mk index 9c748e3..b2b1443 100644 --- a/cfg.mk +++ b/cfg.mk @@ -180,6 +180,11 @@ sc_option_desc_uppercase: @$(MAKE) -s -C src all_programs @$(MAKE) -s -C man $@ +# Ensure all man/*.[1x] files are present +sc_man_file_correlation: + @$(MAKE) -s -C src all_programs + @$(MAKE) -s -C man $@ + # Perl-based tests used to exec perl from a #!/bin/sh script. # Now they all start with #!/usr/bin/perl and the portability # infrastructure is in tests/Makefile.am. Make sure no old-style diff --git a/man/Makefile.am b/man/Makefile.am index 7cebbf1..c3c3803 100644 --- a/man/Makefile.am +++ b/man/Makefile.am @@ -180,7 +180,8 @@ sc_option_desc_uppercase: $(dist_man1_MANS) $(NO_INSTALL_PROGS_DEFAULT:%=%.1) { echo 1>&2 '$(ME): found initial capitals in --help'; \ exit 1; } || :; -distcheck-hook: check-x-vs-1 check-programs-vs-x +.PHONY: sc_man_file_correlation +sc_man_file_correlation: check-x-vs-1 check-programs-vs-x # Sort in traditional ASCII order, regardless of the current locale; # otherwise we may get into trouble with distinct strings that the @@ -193,7 +194,7 @@ ASSORT = LC_ALL=C sort # add them here manually. .PHONY: check-x-vs-1 check-x-vs-1: - $(AM_V_GEN)PATH=../src$(PATH_SEPARATOR)$$PATH; export PATH; \ + @PATH=../src$(PATH_SEPARATOR)$$PATH; export PATH; \ t...@-t;\ (cd $(srcdir) && ls -1 *.x) | sed 's/\.x$$//' | $(ASSORT) > $$t;\ (echo $(dist_man1_MANS) $(NO_INSTALL_PROGS_DEFAULT) \ @@ -207,7 +208,7 @@ all_programs =\ .PHONY: check-programs-vs-x check-programs-vs-x: - $(AM_V_GEN)status=0;\ + @status=0; \ for p in dummy `$(all_programs)`; do \ test $$p = dummy && continue; \ test $$p = ginstall && p=install || : ; \ diff --git a/src/Makefile.am b/src/Makefile.am index addc2eb..feb6c22 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -635,6 +635,7 @@ built_programs.list: all_programs.list: @echo $(all_programs) | tr ' ' '\n' | sed -e 's,$(EXEEXT)$$,,' \ + | sed /libstdbuf/d \ | $(ASSORT) -u # This is required because we have broken inter-directory dependencies: -- 1.6.2.5