[PATCH] dd: do not unnecesarilly allocate memory for input block size, when not needed

2009-05-22 Thread Ondřej Vašík
Hello, as reported in https://bugzilla.redhat.com/show_bug.cgi?id=502026, in dd is an unnecessary memory allocation for input block even if input block buffer is not needed (skip and count set to 0). Attached patch should prevent memory exhaustion error in that very special case. I guess

Re: Human readable sort

2009-05-22 Thread Jim Meyering
Pádraig Brady wrote: Eric Blake wrote: Pádraig Brady P at draigBrady.com writes: ... +static int +find_unit_order (const char *number) +{ + static const char orders [UCHAR_LIM] = { +['K']=1, ['M']=2, ['G']=3, ['T']=4, ['P']=5, ['E']=6, ['Z']=7, ['Y']=8, +['k']=1, + }; This

Re: Human readable sort

2009-05-22 Thread Pádraig Brady
Jim Meyering wrote: Pádraig Brady wrote: Eric Blake wrote: Pádraig Brady P at draigBrady.com writes: ... +static int +find_unit_order (const char *number) +{ + static const char orders [UCHAR_LIM] = { +['K']=1, ['M']=2, ['G']=3, ['T']=4, ['P']=5, ['E']=6, ['Z']=7, ['Y']=8, +

Re: [PATCH] dd: do not unnecesarilly allocate memory for input block size, when not needed

2009-05-22 Thread Pádraig Brady
Ondřej Vašík wrote: Hello, as reported in https://bugzilla.redhat.com/show_bug.cgi?id=502026, in dd is an unnecessary memory allocation for input block even if input block buffer is not needed (skip and count set to 0). Attached patch should prevent memory exhaustion error in that very

Re: Human readable sort

2009-05-22 Thread Jim Meyering
Pádraig Brady wrote: From 75bb07bb620d37d26467ab86ffcf73d47479b358 Mon Sep 17 00:00:00 2001 From: Michael Speer knome...@gmail.com Date: Mon, 27 Apr 2009 14:51:29 +0100 Subject: [PATCH] sort: new --human-numeric-sort option to sort KiB MB etc. * NEWS: Document the new option *

Re: [PATCH] New fallocate module

2009-05-22 Thread Bruno Haible
Hello Pádraig, The documentation files you sent document the status before any 'fallocate' module is added to gnulib. So I committed them for you: 2009-05-21 Pádraig Brady p...@draigbrady.com * doc/glibc-functions/fallocate.texi: New file. * doc/gnulib.texi: Include it. The

Re: [PATCH] New fallocate module

2009-05-22 Thread Pádraig Brady
Bruno Haible wrote: Hello Pádraig, The documentation files you sent document the status before any 'fallocate' module is added to gnulib. So I committed them for you: 2009-05-21 Pádraig Brady p...@draigbrady.com * doc/glibc-functions/fallocate.texi: New file. *

Re: [PATCH] dd: do not unnecesarilly allocate memory for input block size, when not needed

2009-05-22 Thread Ondřej Vašík
Pádraig Brady wrote: So that would not run skip(STDOUT_FILENO,...) if count==0. Would this break existing scripts that for example used this command to position a non seekable device? dd count=0 of=/dev/tape seek=1234 Thanks for objection, you are right, my patch seems to be not correct

Re: [PATCH] dd: do not unnecesarilly allocate memory for input block size, when not needed

2009-05-22 Thread Pádraig Brady
Ondřej Vašík wrote: Pádraig Brady wrote: So that would not run skip(STDOUT_FILENO,...) if count==0. Would this break existing scripts that for example used this command to position a non seekable device? dd count=0 of=/dev/tape seek=1234 Thanks for objection, you are right, my patch

Re: [PATCH] New fallocate module

2009-05-22 Thread Paul Eggert
Pádraig Brady p...@draigbrady.com writes: Well libc, kernel or filesystem could return ENOSYS so code using fallocate() has to handle it anyway. If memory serves, ordinarily gnulib tries to catch such situations, and to substitute a working function when the kernel just has a stub that returns

Re: [PATCH] New fallocate module

2009-05-22 Thread Pádraig Brady
Paul Eggert wrote: Pádraig Brady p...@draigbrady.com writes: Well libc, kernel or filesystem could return ENOSYS so code using fallocate() has to handle it anyway. If memory serves, ordinarily gnulib tries to catch such situations, and to substitute a working function when the kernel just