bug#69979: [PATCH-v2][doc] ls -l doc and size -> maj, min for device files

2024-03-24 Thread Stephane Chazelas
Tags: patch My bad, the patch was incorrect, it should have said "replaced by the corresponding device major and minor numbers as two decimal numbers separated by a comma and at least one space.", as there's not always only once space between the major and minor. See also

bug#69979: [PATCH][doc] ls -l doc and size -> maj, min for device files

2024-03-24 Thread Stephane Chazelas
Package: coreutils Version: 9.4 Tags: patch The ls documentation currently doesn't state that for device files, the size field in the long listing format is replaced by major, minor. Patch attached. -- Stephane diff --git a/doc/coreutils.texi b/doc/coreutils.texi index 8a2104831..c8e3bd110

bug#65659: RFC: changing printf(1) behavior on %b

2023-09-02 Thread Stephane Chazelas
2023-09-01 23:28:50 +0200, Steffen Nurpmeso via austin-group-l at The Open Group: [...] > |FWIW, a "printf %b" github shell code search returns ~ 29k > |entries > |(https://github.com/search?q=printf+%25b+language%3AShell=code=Sh\ > |ell) > | > |That likely returns only a small subset of

bug#65659: RFC: changing printf(1) behavior on %b

2023-09-01 Thread Stephane Chazelas
2023-09-01 07:54:02 -0500, Eric Blake via austin-group-l at The Open Group: [...] > > Well in all case %b can not change semantic in the bash script, since it is > > there for so long, even if it depart from python, perl, libc, it is > > unfortunate but that's the way it is, nobody want a semantic

bug#65659: RFC: changing printf(1) behavior on %b

2023-09-01 Thread Stephane Chazelas
2023-09-01 07:15:14 -0500, Eric Blake: [...] > > Note that in bash, you need both > > > > shopt -s xpg_echo > > set -o posix > > > > To get a XSI echo. Without the latter, options are still > > recognised. You can get a XSI echo without those options with: > > > > xsi_echo() { > > local IFS='

bug#65659: RFC: changing printf(1) behavior on %b

2023-09-01 Thread Stephane Chazelas
2023-08-31 15:02:22 -0500, Eric Blake via austin-group-l at The Open Group: [...] > The current POSIX says that %b was added so that on a non-XSI > system, you could do: > > my_echo() { > printf %b\\n "$*" > } That is dependant on the current value of $IFS. You'd need: xsi_echo() ( IFS=' '

bug#65659: RFC: changing printf(1) behavior on %b

2023-09-01 Thread Stephane Chazelas
2023-09-01 09:44:08 +0300, Oğuz via austin-group-l at The Open Group: > On Fri, Sep 1, 2023 at 7:41 AM Phi Debian wrote: > > My vote is for posix_printf %B mapping to libc_printf %b > > In the shell we already have bc for base conversion. Does POSIX really > have to support C2x %b in the first

bug#65659: RFC: changing printf(1) behavior on %b

2023-09-01 Thread Stephane Chazelas
2023-09-01 07:13:36 +0100, Stephane Chazelas via austin-group-l at The Open Group: > 2023-08-31 10:35:59 -0500, Eric Blake via austin-group-l at The Open Group: > > In today's Austin Group call, we discussed the fact that printf(1) has > > mandated behavior for %b (escape sequ

bug#65659: RFC: changing printf(1) behavior on %b

2023-09-01 Thread Stephane Chazelas
2023-08-31 10:35:59 -0500, Eric Blake via austin-group-l at The Open Group: > In today's Austin Group call, we discussed the fact that printf(1) has > mandated behavior for %b (escape sequence processing similar to XSI > echo) that will eventually conflict with C2x's desire to introduce %b > to

bug#61300: wc -c doesn't advance stdin position when it's a regular file

2023-02-05 Thread Stephane Chazelas
On 2023-02-05 20:59, Paul Eggert wrote: On 2023-02-05 11:59, Pádraig Brady wrote: [...] Let's leave that as-is, please. If 'wc' can output the correct value without reading its input, POSIX does not require 'wc' to do the read, and it seems perverse to modify 'wc' to go to the effort to refuse

bug#61300: wc -c doesn't advance stdin position when it's a regular file

2023-02-05 Thread Stephane Chazelas
"wc -c" without filename arguments is meant to read stdin til EOF and report the number of bytes it has read. When stdin is on a regular file, GNU wc has that optimisation whereby it skips the reading, does a pos = lseek(0,0,SEEK_CUR) to find out its current position within the file, fstat(0) and

bug#45371: race condition in rm --preserve-root=all

2020-12-22 Thread Stephane Chazelas
Hello, [reproduced with rm 8.30 and current git head on ubuntu 20.04 amd64] Whilst trying to answer https://unix.stackexchange.com/questions/505317/using-rm-one-file-system-to-only-delete-files-on-the-local-filesystem I noticed that "rm -rf --preserve-root=all some-dir" was not race-free.

Re: date feature request

2019-12-31 Thread Stephane Chazelas
2019-12-31 16:37:37 +1030, Justin Zobel: [...] > If possible in the next release can we please have a format control to > display the suffix for a date, ie 1st 2nd 3rd 4th. [...] Note that date relies on the locale information to determine the month, day am/pm names. The standard locale

Re: [PATCH] sleep: allow ms suffix for milliseconds

2019-12-02 Thread Stephane Chazelas
2019-11-29 13:30:36 +, Rasmus Villemoes: [...] > but that's a bit cumbersome. Extend sleep(1) to also accept "ms" as a > suffix, so one can instead do > > sleep ${x}ms [...] Note that the sleep builtin of the ksh93 shell does support ms, us and ns as suffixes. There, sleep 1000ms sleep

Re: Does head util cause SIGPIPE?

2019-10-26 Thread Stephane Chazelas
2019-10-25 03:56:49 -0400, Ray Satiro: [...] > Since we only need the first line I can just use find options -print -quit > and skip piping to head. But say we needed the first n results, how would I > do that with head and get find to terminate rather than continue searching? [...] With

Re: Enhancement request to GNU date

2019-10-23 Thread Stephane Chazelas
2019-10-17 14:22:53 +0300, Yair Lenga: [...] > Would like to ask that you will consider the following extension to 'date'. > The change will make it easier to perform basic date manipulations in > scripts. > > The request is to add the following 'suffixes' to the date (similar to the > way

Re: [RFE] mkdir w/chdir

2019-09-03 Thread Stephane Chazelas
2019-09-03 13:12:25 -0700, Vito Caputo: [...] > Lately I've been finding myself wishing there were a flag for mkdir to > cd into the directory, especially in combination with creating parents. > > It's like I'm already thinking in convenient shortcut mode asking for > parents to be created and

Re: md5sum outputs '-' when using stdin

2019-08-26 Thread Stephane Chazelas
2019-08-25 21:03:33 +0100, Stephane Chazelas: [...] > FWIW, the ast-open implementation of "wc" doesn't output that > "-" and doesn't treat "-" as meaning stdin. If you want to > "md5sum -c" stdin there, you need to use "/dev/stdin&

Re: md5sum outputs '-' when using stdin

2019-08-25 Thread Stephane Chazelas
2019-08-23 10:41:01 +0100, coreut...@fastmail.com: [...] > $ echo 'hello world' | md5sum > 6f5902ac237024bdd0c176cb93063dc4 - > > What's use is the '-'? > > Obviously it indicates the file content it taken from the > standard input, but is that of any actual use? [...] It is used by md5sum -c.

Re: /bin/echo -- $var

2019-08-15 Thread Stephane Chazelas
2019-08-15 07:29:37 -0700, Kaz Kylheku (Coreutils): > On 2019-08-15 00:53, Harald Dunkel wrote: > > IMHO they should have kept the "no args allowed" for echo > > ("in the late 70s") and should have introduced a new tool > > "eecho" instead. > > Well, new tool for printing was introduced under the

Re: /bin/echo -- $var

2019-08-14 Thread Stephane Chazelas
2019-08-14 09:28:22 -0700, Kaz Kylheku (Coreutils): [...] > According to POSIX, echo doesn't take options. It is specified > that "Implementations shall not support any options." > (We have options, though, so things are complicated.) [...] The POSIX specification of "echo" is going to change in

Re: Can -f of seq take an integer format?

2019-08-01 Thread Stephane Chazelas
2019-08-01 14:35:32 -0600, Assaf Gordon: [...] > FORMAT must be suitable for printing one argument of type 'double'; > it defaults to %.PRECf if FIRST, INCREMENT, and LAST are all fixed > point decimal numbers with maximum precision PREC, and to %g > otherwise. > > This makes it clear

Re: date: new options to parse input date with strptime(3)

2019-08-01 Thread Stephane Chazelas
2019-08-01 03:24:29 -0600, Assaf Gordon: [...] > > > I like this, and think it's useful functionality. > > > It's equivalent to -f in date(1) on FreeBSD, > > > so we should probably support that short option > > [...] > > > > Note that busybox date has -D for that. > > In gnu date(1), -f is

Re: How to convert a md5sum back to a timestamp?

2019-08-01 Thread Stephane Chazelas
2019-08-01 02:08:59 -0600, Assaf Gordon: [...] > Three notes: > 1. > I would recommend using "-%7.0f minutes" format in "seq" > instead of "%g", as the latter will result in a scientific notation > for large values: > >$ seq -f '-%7g minutes' 2563200 | tail -n1 >-2.5632e+06 minutes > >

Re: date: new options to parse input date with strptime(3)

2019-07-31 Thread Stephane Chazelas
2019-07-31 14:59:42 +0100, Pádraig Brady: > On 26/07/19 08:29, Assaf Gordon wrote: [...] > > Some time ago there was a discussion relating to diffuculties of using > > GNU date's parsing. There was a mention of how using strptime(3) makes > > parsing explicit and easy. > > > > I like that idea,

Re: [PATCH] cat: open any file name after "--"

2019-07-06 Thread Stephane Chazelas
2019-07-05 23:31:06 -0500, Eric Blake: [...] > Sorry, but this patch violates POSIX. > > https://pubs.opengroup.org/onlinepubs/9699919799/toc.htm > > "If a file is '-', the cat utility shall read from the standard input at > that point in the sequence." [...] But coreutils could do that when

Re: Is there a way to gzip the temp file used by `sort`?

2019-07-01 Thread Stephane Chazelas
2019-07-01 10:44:59 -0500, Peng Yu: [...] > The temp files used by `sort` are not gzipped. Is there a way to use > gzip to save the space used by the temp files? Thanks. [...] $ sort --help [...] --compress-program=PROG compress temporaries with PROG;

bug#29038: df hangs on fifos/named pipes

2017-10-30 Thread Stephane Chazelas
2017-10-30 09:53:01 -0700, Pádraig Brady: [...] > I pushed my change with the comments fixed up. > > I thought about O_NONBLOCK and O_PATH but thought these might not > induce or wait for the auto mount to occur. [...] Note that: df /dev/watchdog as root still causes the system to reboot on

bug#29038: df hangs on fifos/named pipes

2017-10-30 Thread Stephane Chazelas
2017-10-29 23:16:50 -0700, Paul Eggert: > Pádraig Brady wrote: > > >I suppose we could stat() and if that succeeds && !fifo, only then call > >open() ? > >Patch to do that is attached. > > Better is to use open with O_NONBLOCK, as this avoids interpreting the file > name twice in the usual

bug#29038: df hangs on fifos/named pipes

2017-10-28 Thread Stephane Chazelas
test case: mkfifo p df p That hangs, unless you make "p" non-readable or some other process has the fifo open in write mode. The reason is that df tries to open the fifo in read-only mode, according to comments in the source code so as to trigger a potential automout. That goes back to

bug#28991: df: wrong output when a FS masks another one

2017-10-25 Thread Stephane Chazelas
Test case: /tmp$ mkdir -p 1/2 /tmp$ sudo mount -o size=1M -t tmpfs x 1/2 /tmp$ sudo mount -o size=2M -t tmpfs y 1 /tmp$ mkdir 1/2 /tmp$ df -h 1/2 Filesystem Size Used Avail Use% Mounted on x 2.0M 0 2.0M 0% /tmp/1/2 The Size is correct as that's obtained from statfs()

Re: suggestion: ls --sort=date

2017-03-15 Thread Stephane Chazelas
2017-03-15 08:08:40 -0500, Eric Blake: > I've frequently forgotten whether it is 'ls --sort=date' or 'ls > --sort=time'. Can we support both spellings, as synonyms, instead of me > having to resort to the help output every time I guess wrong? [...] Some alternatives: use the standard ls -t

bug#24924: GNU pr only working with singlebyte 1-width characters

2016-12-01 Thread Stephane Chazelas
2016-12-01 07:04:05 +, Stephane Chazelas: > 2016-11-30 18:37:05 -0800, Paul Eggert: > [...] > > In the meantime if you could submit a patch for the > > documentation that should fix the immediate documentation > > problem. > [...] > > What about: [...

bug#24924: GNU pr only working with singlebyte 1-width characters

2016-11-30 Thread Stephane Chazelas
2016-11-30 18:37:05 -0800, Paul Eggert: [...] > In the meantime if you could submit a patch for the > documentation that should fix the immediate documentation > problem. [...] What about: diff --git a/doc/coreutils.texi b/doc/coreutils.texi index cc85f22..6eb497b 100644 --- a/doc/coreutils.texi

bug#24924: GNU pr only working with singlebyte 1-width characters

2016-11-30 Thread Stephane Chazelas
2016-11-30 18:37:05 -0800, Paul Eggert: > On 11/30/2016 03:30 AM, Stephane Chazelas wrote: > >That can also be seen as a POSIX conformance bug > > Not really, as POSIX does not require support for UTF-8 (except in > the pax utility, which is not part of coreutils). [...] POSI

bug#24924: GNU pr only working with singlebyte 1-width characters

2016-11-30 Thread Stephane Chazelas
Only arguing on the classification of this bug here. Let's call a cat a cat. When something doesn't work as documented, it's a bug, not a wishlist entry. AFAICT, there's nothing in the GNU coreutils documentation that states that pr only works on input that consists exclusively of single-byte

Re: [PATCH v2 1/2] test: Add unary operator -E: test that a file is an empty directory

2016-04-13 Thread Stephane Chazelas
2016-04-07 10:34:56 +0200, Mattias Andrée: [] > + if (!dir) > +{ > + error (0, errno, "%s", dirname); > + test_exit (TEST_FAILURE); > +} Note that it means it makes it the first operator that would actually cause "test" to output something. A test for non-empty without

Re: Whats the reason to suppress short unicode characters in printf?

2016-04-13 Thread Stephane Chazelas
2016-04-05 08:02:14 -0600, Eric Blake: [...] > That said, it may be time to consider teaching coreutils to accept ALL > \u escapes, rather than just the ones required by C99, as an > extension for ease of use. [...] Especially considering that the current POSIX draft for sh's $'\u' and

bug#23090: true and false not POSIX

2016-03-22 Thread Stephane CHAZELAS
2016-03-22 12:31:50 -0700, Paul Eggert: [...] > It might be helpful to have some other environment variable that > meant "try to be strict about supporting only behavior required by > POSIX", as one could use that to develop shell scripts that were > more portable. However, that would be a lot of

bug#23090: true and false not POSIX

2016-03-22 Thread Stephane Chazelas
2016-03-22 15:39:52 +0100, Ruediger Meier: > On Tuesday 22 March 2016, Stephane Chazelas wrote: > > 2016-03-22 13:43:30 +0100, Ruediger Meier: [...] > Ok, but it must not use STDOUT and it must return 0. > true --help may predict the future of the stars as long as it exits 0 &

bug#23090: true and false not POSIX

2016-03-22 Thread Stephane Chazelas
2016-03-22 13:43:30 +0100, Ruediger Meier: [...] > Is there any good reason why coreutils true and false are not POSIX? > > man 1p true: > OPTIONS >None. > STDOUT >Not used. > > But coreutils true has --version and --help implemented. It needs > >/dev/null redirection to

Re: [PATCH] wc: add -v option to print total counts every second.

2016-03-11 Thread Stephane Chazelas
2016-03-11 12:34:21 +, Pádraig Brady: > On 11/03/16 09:19, Sina Siadat wrote: > >* src/wc.c: add -v option and write live counts to stderr. > > I'd be inclined to call it --progress. Or --progress[=seconds] > However I'm also inclined to think this might be better > placed in a separate

bug#22879: Typo on ls man page

2016-03-02 Thread Stephane Chazelas
2016-03-02 11:17:17 -0500, Assaf Gordon: [...] > >-h, --human-readable > > with -l, print sizes in human readable format (e.g., 1K 234M > > This is not a typo, it is the correct explanation. > Using "-h" by itself (e.g. "ls -h") does not print sizes at all, neither > exact

Re: Possible enhancement: file count

2016-03-02 Thread Stephane Chazelas
2016-02-29 16:59:47 +0100, Ruediger Meier: [...] > What about "du --inodes"? coreutils >= 8.22 [...] Note that it counts the "inodes" which is different from "directory entries". For instance, in a directory that contains 100 entries all hardlinks do the same file, du --inodes will report 2

Re: Possible enhancement: file count

2016-03-01 Thread Stephane Chazelas
2016-02-29 08:48:16 -0700, Eric Blake: > On 02/29/2016 08:23 AM, Fernando Pereira wrote: > > > Anyway, I was looking for the most efficient way to do that and I couldn't > > find satisfying answer. Of course we can use find | wc, but I am really > > looking for a simple and efficient solution

Re: #1303795 RFE: df output is non intuitive - multiple files residing in current directory

2016-02-04 Thread Stephane Chazelas
2016-02-04 09:31:42 +0100, Bernhard Voelker: [...] > > I think df should provide an option to remove duplicates from output by > > supporting --unique option like sort(1). [...] > I'm not too enthusiastic for such an option. This is the first time > I've seen someone doing "df *". Although it

bug#22128: dirname enhancement

2015-12-11 Thread Stephane Chazelas
2015-12-10 10:40:30 -0700, Bob Proulx: [...] > In this instance the first thing I thought of when I read your dirname > -f request was a loop. > >while read dir; do dirname $dir; done < list "read dir" expects the input in a very specific format and depends on the current value of IFS (like

bug#22064: expr: expr string : '.*' returns the number of matched bytes not characters

2015-11-30 Thread Stephane Chazelas
Hello, that's another multibyte issue, it may be known already but I can't see it being referenced on debbugs.gnu.org. $ locale charmap UTF-8 $ expr é : . 2 $ expr é That is, characters are correctly matched, but a number of bytes instead of characters is returned. Same problem with $ expr

Re: Wishlist Feature Request: wc

2015-11-18 Thread Stephane Chazelas
2015-11-18 22:55:34 +1100, Craig Sanders: > wc would be improved if it had two new options: > >--no-total >--no-filenames > > These would eliminate the need to pipe into `awk '$2 != "total" {print > $1}'` or similar to remove totals and filenames from the output when wc > has more than

Re: mkdir and ls display

2015-11-09 Thread Stephane Chazelas
2015-11-09 11:20:20 +, Pádraig Brady: [...] > In any case you can use `find ... -print0 | xargs -0` > to handle that. [...] Note that that is the FreeBSD syntax, with GNU xargs, you need: find ... -print0 | xargs -r0 ... So that ... be not executed when find produces no output. Or you can

Re: removal of kill?

2015-11-09 Thread Stephane Chazelas
2015-11-09 15:27:41 +, Pádraig Brady: > I see on most GNU/Linux distros that kill(1) is > provided by the shell or util-linux. > Should we just remove it from coreutils? > > We might move 'kill' to the disabled_by_default_progs > list in build-aux/gen-lists-of-programs.sh, > but I'm

Re: date enhancement - filter to preface each line of input with timestamp

2015-11-02 Thread Stephane Chazelas
2015-11-02 14:14:38 -0700, Eric Blake: > On 11/02/2015 01:56 PM, Shawn McMahon wrote: > > On Mon, Nov 2, 2015 at 3:52 PM, Evan Rempel wrote: > > > >> > >> The task is easy to solve in nearly any language, but I can not depend on > >> awk, perl, python, tcl, java or any other

Re: Feature suggestion: sort --skip-header-lines=N (and perhaps --skip-trailer-lines?)

2015-10-26 Thread Stephane Chazelas
2015-10-26 11:40:54 +, Pádraig Brady: [...] > Summary is you can do this with GNU sed: > > ( echo 99 ; seq 10 ) | ( sed -u 1q ; sort -n ) [...] Or POSIXly: awk 'NR <= 3 {print; next}; {print | "sort -n"}' Or: (IFS= read -r line && printf '%s\n' "$line"; sort -n) On systems that still

bug#21636: a question of the “wc” program

2015-10-06 Thread Stephane Chazelas
2015-10-06 10:01:15 -0600, Eric Blake: > tag 21636 notabug > thanks > > On 10/06/2015 04:49 AM, JameDam wrote: > > I have a file which is named *“-l”*, and I use the wc to count the file, > > undesirably wc requested the standard input rather than my file *"-l"* > > ,although > > I use it

Re: RFE: head,tail: -z, --zero-terminated

2015-09-28 Thread Stephane Chazelas
2015-09-26 15:43:40 +0100, Richard Russon: > I'd like to add an option to both head and tail, > to allow them to work with NUL-terminated lines of text > -z, --zero-terminated > > Thus allowing: > > find dir -type f -print0 | head -z -n 10 | xargs -0 command [...] See also sed -z 10q

Re: Functionality in 'cp' and 'mv' command

2015-08-31 Thread Stephane Chazelas
2015-08-31 11:50:36 +0100, Pádraig Brady: > On 31/08/15 06:57, Abhilash Mhaisne wrote: > > Hey all. > > > > When the cp or mv command is executed, no progress of copying is shown. > > The verbose option shows the source and destination, but not the progress. > > > > In the wget tool, download

Re: What is the best way to touch a file and set its time of the last time of a bunch of other files?

2015-08-31 Thread Stephane Chazelas
2015-08-07 02:21:07 -0500, Peng Yu: > Hi, `touch -r` allows one to set the time of a file same as a > reference file. What if one wants to set the time to be the last time > of multiple files? Is there an easy way to do so? [...] With zsh, touch -r /path/to/*(om[1]) file Would set file's time

Re: What is the best way to touch a file and set its time of the last time of a bunch of other files?

2015-08-31 Thread Stephane Chazelas
2015-08-07 11:09:52 +0200, Andreas Schwab: > Andreas Schwab writes: > > Peng Yu > > > > writes: > > > >> Hi, `touch -r` allows one to set the time of a file same as a > >>

Re: Extensions to the `base64' Program

2015-08-31 Thread Stephane Chazelas
2015-08-31 14:39:57 +0100, Pádraig Brady: [...] > > The problem is that `base64' doesn't support the RFC 4648 > > standard. An obvious work around is to do something akin to > > "cat | sed 's/-/+/' | sed 's|_|/|' | base64 --decode" > > or whatever (forgive the double sed please). However, it >

bug#21356: BUG: split shorter version of '--numeric-suffixes' give error

2015-08-27 Thread Stephane Chazelas
2015-08-27 16:18:51 +0100, Pádraig Brady: [...] info page: [...] It's easy to miss that it's not `-d[FROM]` here. A note along these lines could help: Note that the FROM value can only be specified with the long option from. Done at:

bug#21356: BUG: split shorter version of '--numeric-suffixes' give error

2015-08-27 Thread Stephane Chazelas
2015-08-27 00:05:49 +0100, Pádraig Brady: [...] $ split -n10 -a4 -d5 echo.txt split: cannot split in more than one way Try 'split --help' for more information. where as using longer option for `-d` i.e. `--numeric-suffixes` works fine. $ split -n10 -a4 --numeric-suffixes=5 echo.txt

bug#21265: tail -f: inotify being used on non-regular files

2015-08-26 Thread Stephane Chazelas
2015-08-26 03:13:59 +0100, Pádraig Brady: [...] I notice both with and without inotify there is a similar issue (for different reasons) when multiple devices are specified: tail ---dis -f /dev/tty /dev/tty I.E. we generally can't deal with this case in either case, though it probably

bug#21325: ls : feature request --width=zero

2015-08-23 Thread Stephane Chazelas
2015-08-23 13:26:35 +0200, Erik Auerswald: Hi, On Sat, Aug 22, 2015 at 08:58:01PM -0700, Paul Eggert wrote: Pádraig Brady wrote: Also base64 -w0 has similar meaning. I didn't know that, but I don't like that either. Utilities should use an explicit representation for infinity, if

bug#21265: tail -f: inotify being used on non-regular files

2015-08-15 Thread Stephane Chazelas
Hello, it seems on Linux, GNU tail -f uses inotify to check if data is available even for those types of files where inotify doesn't work. For instance, when running: tail -fn+1 /dev/tty Then press 1ReturnCtrl-D2ReturnCtrl-D3Return4Return $ tail -fn+1 /dev/tty 1 1 ^D2 2 ^D3 4 upon the first

bug#21098: uname man page

2015-07-22 Thread Stephane Chazelas
2015-07-22 01:54:58 +0100, Pádraig Brady: [...] On 21/07/15 14:34, Paul Eggert wrote: Thanks, that patch looks good, except for some nits. POSIX spells the phrase non-portable and we might as well be consistent. The --help lines would look better as: -p, --processor

bug#20954: wc - linux

2015-07-02 Thread Stephane Chazelas
2015-07-01 19:41:00 -0600, Bob Proulx: [...] $ a= ; echo $s | wc -l 1 [...] No. Should be 1. You have forgotten about the newline at the end of the command. The echo will terminate with a newline. [...] Leaving a variable unquoted will also cause the shell to apply the split+glob

bug#20936: suggestion for a 'wart-ish' extension off of 'sort'

2015-06-30 Thread Stephane Chazelas
2015-06-30 13:05:38 -0400, Assaf Gordon: [...] One more thing: instead of 'du -s *', perhaps 'du -d1' would work better (depending on your needs), as it will print sizes used only by directories. Yes, and it will also include hidden files/dirs and won't have problems with filenames starting

bug#20936: suggestion for a 'wart-ish' extension off of 'sort'

2015-06-30 Thread Stephane Chazelas
2015-06-30 12:51:02 +0200, Erik Auerswald: [...] But more a more obvious problem is 'du -shc' seems to be coming up with the wrong number -- i.e. 1.5+3.6 = 5.1, not 5.0. That are probably rounding errors avoided by du, that hsort cannot avoid anymore. [...] Also, du -c gives you the

bug#20928: cut (v. 8.21), using -f option with a single column

2015-06-29 Thread Stephane Chazelas
2015-06-29 16:31:00 +0100, Pádraig Brady: [...] When there is only one column and we go beyond 1 with the -f option, the output remains the first column $ echo test1 | cut -d' ' -f1 test1 $ echo test1 | cut -d' ' -f2 test1 $ echo test1 | cut -d' ' -f3 test1 That difference

bug#20928: cut (v. 8.21), using -f option with a single column

2015-06-29 Thread Stephane Chazelas
2015-06-29 17:25:11 +0100, Pádraig Brady: [...] $ printf '%s\n' a:b c d:e | paste -d: - /dev/null | cut -d: -f2 b e Good point. Or to better support field ranges: $ printf '%s\n' a:b c d:e | sed 's/^[^:]*$/:/' | cut -d: -f2- b e [...] Maybe better as: $ printf '%b\n' a:b

Re: [FR] du option to show .files/.folders

2015-06-24 Thread Stephane Chazelas
2015-06-24 04:13:12 +, Yurii Kolesnykov: Sorry, this command is not that I want, becaus it shows only folders, but no files in current catalog. du -ahd1 See also https://unix.stackexchange.com/a/186230 https://unix.stackexchange.com/a/176173 https://unix.stackexchange.com/a/75795 --

bug#20835: rmdir foo/. fails

2015-06-17 Thread Stephane Chazelas
2015-06-17 10:24:13 +, Ed Avis: % mkdir foo % rmdir foo/. rmdir: failed to remove ‘foo/.’: Invalid argument % rmdir --version rmdir (GNU coreutils) 8.23 Copyright (C) 2014 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html. This

bug#20745: I would like to make a request for the sort command

2015-06-08 Thread Stephane Chazelas
2015-06-08 11:16:37 +0200, Erik Auerswald: [...] FWIW I use 'sort' to sort IPv4 addresses in my ping_scan[1] script. The info documentation for sort provides another example, log files sorted by IP address and time stamp. That specific example even needs two runs of sort, because sort lacks

bug#20745: I would like to make a request for the sort command

2015-06-08 Thread Stephane Chazelas
2015-06-08 12:43:32 +0200, Erik Auerswald: [...] I'm not even sure having a tool just for that specific task would make sense though. Here, it sounds more like a job for a high level language like perl/python... (what if I want to sort on roman numerals now, week day names, astrological

bug#20767: seq invocation limitations documentation

2015-06-08 Thread Stephane Chazelas
2015-06-08 07:28:25 +0800, 積丹尼 Dan Jacobson: On (info (coreutils) seq invocation) perhaps mention if one needs to use two % items, a for loop might be required, $ for i in `seq 14484 1 34484`; do printf %d=0x%x\\n $i $i; done 14484=0x3894 24484=0x5fa4 34484=0x86b4 [...] Running

bug#20745: I would like to make a request for the sort command

2015-06-08 Thread Stephane Chazelas
2015-06-08 11:16:37 +0200, Erik Auerswald: [...] FWIW I use 'sort' to sort IPv4 addresses in my ping_scan[1] script. The info documentation for sort provides another example, log files sorted by IP address and time stamp. That specific example even needs two runs of sort, because sort lacks

bug#20745: I would like to make a request for the sort command

2015-06-08 Thread Stephane Chazelas
2015-06-08 08:14:20 -0600, Eric Blake: On 06/08/2015 05:14 AM, Stephane Chazelas wrote: Maybe there's a way to allow that without having to implement the specifics in sort. Like sort key flags to invoke commands: sort '-k1,1|ip2hex' '-k2,2n|roman2int' '-k3,3|iconv -t us

bug#20751: wc -m doesn't count UTF-8 characters properly

2015-06-07 Thread Stephane Chazelas
2015-06-06 21:49:16 +0300, Valdis Vītoliņš: Note, that UTF-8 characters can be counted by counting bytes with bit patterns 0xxx or 11xx: https://en.wikipedia.org/wiki/UTF-8#Description So, general logic should be, that, if: a) locale setting is utf-8 (e.g. LANG=xx_XX.UTF-8), or b)

bug#20733: [PATCH] doc: mention 'for' syntax issue on older shells

2015-06-05 Thread Stephane Chazelas
2015-06-04 16:32:48 -0600, Eric Blake: On 06/04/2015 02:59 PM, Eric Blake wrote: +good: + @@list='$(list)'; for arg in $$list; do echo $$arg; done [...] Another option is to use: for arg in $${-+$(list)}; do echo $$arg; done Furthermore, your suggestion mishandles a list

bug#20733: coreutils build problem

2015-06-05 Thread Stephane Chazelas
2015-06-04 16:51:49 -0700, Paul Eggert: Eric Blake wrote: Actually, POSIX_does_ allow for missing words between 'in' and the terminator (; or newline) before 'do' (whether by a word that expands to nothing, or by omission of words), requiring that the body of the for statement is skipped in

bug#20733: coreutils build problem

2015-06-05 Thread Stephane Chazelas
2015-06-05 09:43:10 +0100, Stephane Chazelas: 2015-06-04 16:51:49 -0700, Paul Eggert: [...] Ah, sorry, I was thinking of previous versions of POSIX, which required at least one word after the 'in'. You're right, the current POSIX version doesn't require this any more. So the Solaris sh

bug#20733: [PATCH] doc: mention 'for' syntax issue on older shells

2015-06-04 Thread Stephane Chazelas
2015-06-04 14:06:03 -0600, Eric Blake: [...] +$ @kbd{cat Makefile} +list = +bad: + @@for arg in $(list); do echo $$arg; done +good: + @@list='$(list)'; for arg in $$list; do echo $$arg; done [...] Another option is to use: for arg in $${-+$(list)}; do echo $$arg; done That's

bug#20725: Shuf problem

2015-06-03 Thread Stephane Chazelas
2015-06-03 14:33:35 +0100, Pádraig Brady: On 03/06/15 14:20, Federico Alves wrote: I think that shuf should have an option, may set ON by default, to avoid empty lines in a file when shuffling it. if a file has 100 lines and ten are simply returns, 99% of the time I do not want an empty

Re: wc: expand help of '-L' (and a question)

2015-05-13 Thread Stephane Chazelas
2015-05-13 03:00:48 +0100, Pádraig Brady: [...] Yes. You could filter with sed to adjust: sed 's/././g' | wc -L# count chars LC_ALL=C sed 's/././g' | wc -L# count bytes [...] Note that unicode code points D800 to DFFF (reserved for UTF-16 encoding) and 11 to 7FFF now

bug#20553: 'echo -e' does not escape backslash correctly

2015-05-12 Thread Stephane Chazelas
2015-05-11 17:36:50 -0600, Eric Blake: On 05/11/2015 04:14 PM, Pádraig Brady wrote: echo -e net use z: srv\\aqs /persistent:no /user:%USERNAME% $BG_PASSWD\r 'echo -e' is non-portable. POSIX recommends that you use printf instead, as the POSIX version of echo is supposed to behave

bug#20553: 'echo -e' does not escape backslash correctly

2015-05-11 Thread Stephane Chazelas
2015-05-11 23:50:25 +0200, Jo Drexl (FFGR-IT): Hi guys, I had to write a Windows bat file for twentysomething users and - as Linux geek - wrote a small Bash script for it. The code in question is as follows: echo -e net use z: srv\\aqs /persistent:no /user:%USERNAME% $BG_PASSWD\r [...]

bug#19765: tail -F stops watching when read permissions are removed

2015-02-04 Thread Stephane Chazelas
When watchnig a file by name with tail -F, if read permissions are removed, tail stops watching even though it has a file descriptor open on the file. With inotify: $ : file $ tail -F file [1] 20796 $ exec 3 file $ echo 1 3 1 $ chmod 0 file tail: %

bug#19760: [bug] tail -f with inotify fails to follow a file after a rename()

2015-02-03 Thread Stephane Chazelas
head). I don't think IN_DELETED_SELF is useful in follow-name mode either, but I've not removed it. -- Stephane From f97355fa31f5e13f95667a50908506388d62df64 Mon Sep 17 00:00:00 2001 From: Stephane Chazelas stephane.chaze...@gmail.com Date: Tue, 3 Feb 2015 21:22:06 + Subject: [PATCH] tail: fix

[Doc] wrong usage example for dircolors

2004-12-14 Thread Stephane Chazelas
That typical usage example in the info page for dircolors: eval `dircolors [OPTION]... [FILE]` (see http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/coreutils/coreutils/doc/coreutils.texi?rev=1.233 @example eval `dircolors [EMAIL PROTECTED]@dots{} [EMAIL PROTECTED] @end example) is not