bug#39364: [PATCH] rmdir: fix clobbered errno

2020-02-09 Thread Bernhard Voelker
On 2020-02-07 14:58, Pádraig Brady wrote: > Yes the existing is_empty_dir() interface didn't change. > We just added more info (errno) in the non empty case, > that is not inspected by remove.c (which is fine for its uses). Thanks for checking. Have a nice day, Berny

bug#39364: [PATCH] rmdir: fix clobbered errno

2020-02-07 Thread Pádraig Brady
On 06/02/2020 18:04, Bernhard Voelker wrote: On 2020-02-04 20:21, Pádraig Brady wrote: pushed. marking done Hi Padraig, I just noticed that 'is_empty_dir' from 'src/system.h' is also used in 'src/remove.c', so - without having looked there yet - it could be that the patch changed something in

bug#39364: [PATCH] rmdir: fix clobbered errno

2020-02-06 Thread Bernhard Voelker
On 2020-02-04 20:21, Pádraig Brady wrote: > pushed. marking done Hi Padraig, I just noticed that 'is_empty_dir' from 'src/system.h' is also used in 'src/remove.c', so - without having looked there yet - it could be that the patch changed something in rm(1) as well (good or bad). Did you check? T

bug#39364: [PATCH] rmdir: fix clobbered errno

2020-02-04 Thread Pádraig Brady
On 03/02/2020 16:45, Pádraig Brady wrote: On 03/02/2020 13:26, Pádraig Brady wrote: On 31/01/2020 17:51, Pádraig Brady wrote: Actually I think the key issue is not errno handling, but a logic error fixed with: @@ -102,7 +102,7 @@ ignorable_failure (int error_number, char const *dir) retur

bug#39364: [PATCH] rmdir: fix clobbered errno

2020-02-03 Thread Pádraig Brady
On 03/02/2020 13:26, Pádraig Brady wrote: On 31/01/2020 17:51, Pádraig Brady wrote: Actually I think the key issue is not errno handling, but a logic error fixed with: @@ -102,7 +102,7 @@ ignorable_failure (int error_number, char const *dir) return (ignore_fail_on_non_empty &&

bug#39364: [PATCH] rmdir: fix clobbered errno

2020-02-03 Thread Jim Meyering
On Mon, Feb 3, 2020 at 5:28 AM Pádraig Brady wrote: ... > Actually I think the key issue is not errno handling, > but a logic error fixed with: > > @@ -102,7 +102,7 @@ ignorable_failure (int error_number, char const *dir) > return (ignore_fail_on_non_empty > && (errno_rmdir_non_emp

bug#39364: [PATCH] rmdir: fix clobbered errno

2020-02-03 Thread Pádraig Brady
On 31/01/2020 17:51, Pádraig Brady wrote: On 31/01/2020 01:46, Matthew Pfeiffer wrote: 'rmdir --ignore-fail-on-non-empty' would not report errors on non-empty directories that fail for a different reason. --- src/rmdir.c | 10 ++ 1 file changed, 6 insertions(+), 4 deletions(-) diff

bug#39364: [PATCH] rmdir: fix clobbered errno

2020-02-02 Thread Jim Meyering
On Sun, Feb 2, 2020 at 5:11 AM Bernhard Voelker wrote: > On 2020-02-02 07:32, Jim Meyering wrote: > > FTR, here's a minimal test addition that exercises the bug. Succeeds > > on 6.10, fails on 6.11: > > Minor tweak for the test ... > > -rmdir --ignore-fail-on-non-empty x/y && fail=1 > +returns_ 1

bug#39364: [PATCH] rmdir: fix clobbered errno

2020-02-02 Thread Bernhard Voelker
On 2020-02-02 07:32, Jim Meyering wrote: > FTR, here's a minimal test addition that exercises the bug. Succeeds > on 6.10, fails on 6.11: Minor tweak for the test ... -rmdir --ignore-fail-on-non-empty x/y && fail=1 +returns_ 1 rmdir --ignore-fail-on-non-empty x/y || fail=1 ... due to: tes

bug#39364: [PATCH] rmdir: fix clobbered errno

2020-02-01 Thread Jim Meyering
On Fri, Jan 31, 2020 at 9:55 AM Pádraig Brady wrote: > ... > This looks like a regression introduced in v6.10-21-ged5c4e7 > I.E. is_empty_dir() is globbering errno, and thus > a non specific and non terminating warning is output, > rather than a specific error, and exit. FTR, here's a minimal tes

bug#39364: [PATCH] rmdir: fix clobbered errno

2020-02-01 Thread Jim Meyering
Nice find and thank you for the patch. That's a 12-year-old bug I introduced. I confirm: with 6.10, running this: mkdir -p a/b && chmod a-w a && rmdir --ignore a/b prints this and exits nonzero: rmdir: failed to remove `a/b': Permission denied With 6.11 and newer, it silently succeeds. On Fri

bug#39364: [PATCH] rmdir: fix clobbered errno

2020-01-31 Thread Pádraig Brady
On 31/01/2020 01:46, Matthew Pfeiffer wrote: 'rmdir --ignore-fail-on-non-empty' would not report errors on non-empty directories that fail for a different reason. --- src/rmdir.c | 10 ++ 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/rmdir.c b/src/rmdir.c index c9f4

bug#39364: [PATCH] rmdir: fix clobbered errno

2020-01-30 Thread Matthew Pfeiffer
'rmdir --ignore-fail-on-non-empty' would not report errors on non-empty directories that fail for a different reason. --- src/rmdir.c | 10 ++ 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/rmdir.c b/src/rmdir.c index c9f417957..7b253ab0d 100644 --- a/src/rmdir.c +++ b/s