Re: Bug or Feature in mkdir(1)

2008-11-21 Thread Eric Blake
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 According to Gordon Hamachi on 11/21/2008 1:58 PM: > The problem is, when I use mkdir -p -m it only sets the mode of the > last directory. All of the parent directories take the default mode, > which is not what I want. It would be convenient if ther

Re: [PATCH] Don't do unneccesary memory copies in dd.

2008-11-21 Thread Pádraig Brady
Jim Meyering wrote: > Paul Eggert <[EMAIL PROTECTED]> wrote: >> >> The simplest fix I see is to revert the patch. Of course one could up >> with something fancier > > Good catch! Thank you. > I've done that, and added a test for the required behavior. > >>From 80d42899ec71f237b65f5c974e0a2c

Bug or Feature in mkdir(1)

2008-11-21 Thread Gordon Hamachi
When I use mkdir -p it makes parent directories as needed. Fine. When I use mkdir -m it sets the permission mode of the directory I make. Also fine. The problem is, when I use mkdir -p -m it only sets the mode of the last directory. All of the parent directories take the default mode, which is

Re: [PATCH] Don't do unneccesary memory copies in dd.

2008-11-21 Thread Pádraig Brady
Pádraig Brady wrote: > Paul Eggert wrote: >> $ (echo 'x'; sleep 10; echo y) | dd ibs=3 obs=3 >> >> POSIX says that in this case the output data must be reblocked into >> blocks of 3 bytes. With the working 'dd', you'll see a pause of 10 >> seconds (because the first 'echo' outputs only 2 bytes), t

Re: [PATCH] Don't do unneccesary memory copies in dd.

2008-11-21 Thread Jim Meyering
Paul Eggert <[EMAIL PROTECTED]> wrote: > Pádraig Brady <[EMAIL PROTECTED]> writes: >> * src/dd.c: If output buffer size would be >> the same size as the input buffer, just use >> a single buffer to avoid redundant memory copy. > > Unfortunately this patch introduced a bug into 'dd', so that it no >

Re: [PATCH] Don't do unneccesary memory copies in dd.

2008-11-21 Thread Pádraig Brady
Paul Eggert wrote: > $ (echo 'x'; sleep 10; echo y) | dd ibs=3 obs=3 > > POSIX says that in this case the output data must be reblocked into > blocks of 3 bytes. With the working 'dd', you'll see a pause of 10 > seconds (because the first 'echo' outputs only 2 bytes), then the x and > y right awa

Re: [PATCH]: ls: add --user-format option for user defined format

2008-11-21 Thread Jim Meyering
Paul Eggert <[EMAIL PROTECTED]> wrote: > Jim Meyering <[EMAIL PROTECTED]> writes: >> - is it worthwhile to add a --printf option to ls? >> I don't like the --user-format name) >> >> - if so, should it use use a find -printf-compatible format string >> or one compatible to stat --pri

Re: [PATCH]: chmod - do inform about using different mode than requested with SGID/SUID/sticky bits without permissions to change them

2008-11-21 Thread Matthew Woehlke
Ondřej Vašík wrote: Andreas Schwab wrote: Eric Blake writes: Would a double --verbose make sense? +1 from the random user/lurker :-). --verbose=2 Rather than some level-numbers I do prefer --verbose and --verbose=high ... $0.02: I'm lazy, I like '-vv' :-). (Whichever way is fine for the

Re: [PATCH] Don't do unneccesary memory copies in dd.

2008-11-21 Thread Paul Eggert
Pádraig Brady <[EMAIL PROTECTED]> writes: > * src/dd.c: If output buffer size would be > the same size as the input buffer, just use > a single buffer to avoid redundant memory copy. Unfortunately this patch introduced a bug into 'dd', so that it no longer conforms to POSIX. The C_TWOBUFS option

Re: [PATCH]: ls: add --user-format option for user defined format

2008-11-21 Thread Paul Eggert
Jim Meyering <[EMAIL PROTECTED]> writes: > - is it worthwhile to add a --printf option to ls? > I don't like the --user-format name) > > - if so, should it use use a find -printf-compatible format string > or one compatible to stat --printf? Either way, it'll need a few > ex

Re: unix command od got a bug

2008-11-21 Thread Pádraig Brady
Chunyin Kung 龔俊穎 wrote: > hi Sir, > > I found my binary file including the data below will produce " *" by > command od Hi, You need to use the -v option. Personally I use this alias a lot: alias hd='od -Ax -tx1z -v' Pádraig. ___ Bug-coreutils m

Re: unix command od got a bug

2008-11-21 Thread Eric Blake
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 According to Chunyin Kung 龔俊穎 on 11/20/2008 7:55 PM: > hi Sir, > > I found my binary file including the data below will produce " *" by > command od This is not a bug, but the documented behavior of od. See http://www.opengroup.org/onlinepubs/009

unix command od got a bug

2008-11-21 Thread Chunyin Kung 龔俊穎
hi Sir, I found my binary file including the data below will produce " *" by command od input binary file output ascii file B.R. Chun-Yin Kung (龔俊穎) == 3G Development Div. Communication BU Sunplus mMobile Technology CO., Ltd. TEL : +886-3-5799699 ext. 6

Re: Possible bug with grep/sed/tail?

2008-11-21 Thread Paolo Bonzini
Andreas Schwab wrote: > Paolo Bonzini <[EMAIL PROTECTED]> writes: > >> alias line-buffer='preload /t/linebuf.so' > > If you end the alias expansion with a space then the next word is also > expanded as an alias. Indeed, this does it alias line-buffer='LD_PRELOAD=/t/linebuf.so ' Cool, thank

Re: Possible bug with grep/sed/tail?

2008-11-21 Thread Jim Meyering
Andreas Schwab <[EMAIL PROTECTED]> wrote: > Paolo Bonzini <[EMAIL PROTECTED]> writes: > >> alias line-buffer='preload /t/linebuf.so' > > If you end the alias expansion with a space then the next word is also > expanded as an alias. Ah, yes. That was it. Thanks ;-) ___

Re: Possible bug with grep/sed/tail?

2008-11-21 Thread Andreas Schwab
Paolo Bonzini <[EMAIL PROTECTED]> writes: > alias line-buffer='preload /t/linebuf.so' If you end the alias expansion with a space then the next word is also expanded as an alias. Andreas. -- Andreas Schwab, SuSE Labs, [EMAIL PROTECTED] SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnber

Re: Possible bug with grep/sed/tail?

2008-11-21 Thread Paolo Bonzini
> But if the shared library is installed, you can > instead use your own line-buffer function: > > line-buffer() > { > LD_PRELOAD=/t/linebuf.so "$@" > } > > but that doesn't expand the command name when it's an alias or function. It actually works for functions. To support aliases, you can d

Re: Possible bug with grep/sed/tail?

2008-11-21 Thread Reuben Thomas
On Fri, 21 Nov 2008, Jim Meyering wrote: But now, when I see it's so easy to roll your own, I wonder if it's worth adding a C program to do that for you. Opinions? The most important thing is that this apparently long-standing problem be fixed in the way that places the least burden on the u

Re: Possible bug with grep/sed/tail?

2008-11-21 Thread Jim Meyering
Brian Dessent <[EMAIL PROTECTED]> wrote: > It has been said before in previous threads but I want to re-state that > this is possible in a very simple and general way with the LD_PRELOAD > facility: > > $ echo '__attribute__((constructor)) void f() { setvbuf (stdout, NULL, > _IOLBF, 0); }' | \ >

Re: Possible bug with grep/sed/tail?

2008-11-21 Thread Pádraig Brady
Karl Berry wrote: > It's probably useful to add this functionality to all coreutil filters. > > Wouldn't it suffice to add buffer control options to cat, rather than > every program? Unfortunately it's the middle of the pipeline that usually causes the buffering issues and so sticking a cat -

Re: [PATCH] Don't do unneccesary memory copies in dd.

2008-11-21 Thread Pádraig Brady
Jim Meyering wrote: > I was disappointed to see no performance improvement. > But it's not too surprising: this affects dd only with a block > size that's so low (512) that the cost of the memcpy is > lost in the noise of the read/write syscalls. > Maybe on some small/old CPU it actually does make

Re: Possible bug with grep/sed/tail?

2008-11-21 Thread Paolo Bonzini
Karl Berry wrote: > It's probably useful to add this functionality to all coreutil filters. > > Wouldn't it suffice to add buffer control options to cat, rather than > every program? Unfortunately no -- it's the other program that needs to be taught about the buffering policy to adopt. tail

Re: [PATCH] Don't do unneccesary memory copies in dd.

2008-11-21 Thread Jim Meyering
Pádraig Brady <[EMAIL PROTECTED]> wrote: > I was surprised that dd did memcpy() by default, > which one can see using: > > ltrace -e memcpy dd if=/dev/zero of=/dev/null count=10 > > Now if you specify bs=512 for example > a memcpy() is not done, which seems inconsistent to me. > > What about the a