Re: [PATCH 0/1] xnanosleep: Use pause for infinite duration.

2020-02-16 Thread Vladimir Panteleev
On 16/02/2020 20.55, Paul Eggert wrote: > I installed the attached, which is a bit more conservative than your > suggestion, as it doesn't assume that 'pause' exists or that it indeed > sleeps forever (though I know of no counterexamples, there's little > difficulty in relaxing those assumptions).

Re: restrict

2020-02-16 Thread Bruno Haible
Paul Eggert wrote: > if GCC generated warnings for that sort of thing, the warnings would be false > alarms. Yes, and this in turn means that the ability to produce useful warnings via 'restrict' is limited. In this example: === #incl

Re: restrict

2020-02-16 Thread Paul Eggert
On 2/16/20 4:14 PM, Bruno Haible wrote: I thought that passing pointers to different elements of the same array would produce warnings. But I was mistaken: This code does NOT produce warnings. Yes, and I don't see why such code has undefined behavior, as long as the function doesn't actually a

Re: [PATCH] m4: fix --disable-rpath for AIX

2020-02-16 Thread Bruno Haible
Hi Clement, > Currently, --disable-rpath will add directly $found_so to the compilation > line. However, on AIX, this will result on the path being hardcoded in > the built binaries. > The only way to avoid hardcoded paths without using linker flags (like > -Wl,-bnoipath) is to add -l$name. Can y

Re: restrict

2020-02-16 Thread Bruno Haible
Addendum: > > >- 'restrict' should NOT be used for multiple output parameters of the > > > same type, when only a single word is written through each parameter. > > > Example: ssize_t copy_file_range (int ifd, off_t *ipos, int ofd, > > > off_t *opos, > > >

Re: restrict

2020-02-16 Thread Bruno Haible
Hi Paul, Thanks a lot for your comments. > >- If all pointer parameters point to different types, excluding 'void *', > > ISO C forbids aliasing anyway, therefore 'restrict' is redundant. > > The actual ISO C rule is a bit different, since it allows aliasing between > 'char > *', 'uns

Re: static allocations vs. memory leaks

2020-02-16 Thread Bruno Haible
> Ideally, valgrind would have a way to distinguish static memory allocations > from leaks (where by "leak" I mean an allocation that would accumulate when > the code is run repeatedly). How could such a distinction be implemented, > without multiplying the time needed to run the test by a factor o

Re: [PATCH] fchmodat, lchmod: port to buggy Linux filesystems

2020-02-16 Thread Bruno Haible
> > Perhaps lchmod.m4 and fchmodat.m4 should define a symbol > > HAVE_LCHMOD_BUG_WITH_NON_SYMLINKS and the C code could refer to that. > 2020-02-16 Bruno Haible > > lchmod: Make more future-proof. > * m4/lchmod.m4 (gl_FUNC_LCHMOD): Define NEED_LCHMOD_NONSYMLINK_FIX. > (gl_P

Re: fstrcmp: memory is not reclaimed on exit

2020-02-16 Thread Bruno Haible
Paul Eggert wrote: > it's merely choosing a point in a design space that involves simplicity, > efficiency, correctness, testability, etc. and where there are several > reasonable choices. Right. In the case of fstrcmp, the bison tests use 'valgrind -q'. Akim could use 'valgrind -q --leak-check=

Re: fstrcmp: memory is not reclaimed on exit

2020-02-16 Thread Paul Eggert
On 2/16/20 12:44 PM, Jeffrey Walton wrote: The coding standard is wrong in this area. The practice breaks testing. Not really. It breaks some tests, which are arguably testing the wrong thing. Any tests that check for whether all memory is freed just before exit, are testing for a property th

Re: restrict

2020-02-16 Thread Paul Eggert
On 2/9/20 7:02 PM, Bruno Haible wrote: - If all pointer parameters point to different types, excluding 'void *', ISO C forbids aliasing anyway, therefore 'restrict' is redundant. The actual ISO C rule is a bit different, since it allows aliasing between 'char *', 'unsigned char *', 's

Re: [PATCH] fchmodat, lchmod: port to buggy Linux filesystems

2020-02-16 Thread Bruno Haible
Paul Eggert wrote: > > 2) Also the discussion what is the "right" behaviour is specific to Linux. > > The code in the '#else' case > > > >if (S_ISLNK (st.st_mode)) > > { > >close (fd); > >errno = EOPNOTSUPP; > >return -1; > > } > > > > will surely upset users

Re: [PATCH 0/1] xnanosleep: Use pause for infinite duration.

2020-02-16 Thread Paul Eggert
On 2/10/20 4:26 AM, Vladimir Panteleev wrote: I'm not sure if isfinite is the best way to check for infinity, as far as the tradeoff between portability and dependencies goes. We can use the same test that dtotimespec uses, since we want to sleep forever not only if the argument is infinity,

Re: fstrcmp: memory is not reclaimed on exit

2020-02-16 Thread Jeffrey Walton
On Sun, Feb 16, 2020 at 7:53 AM Bruno Haible wrote: > > ... > > I agree, I would like to be able to explicitly release the memory. But > > I can't see any API to do that in fstrcmp.c. Is this one ok? > > The GNU Coding Standards [1] tell us to not worry about this situation. > However, > the al

Re: [PATCH] fchmodat, lchmod: port to buggy Linux filesystems

2020-02-16 Thread Bruno Haible
Hi Paul, > One other possible bug is that the mode could change temporarily and then > spontaneously revert later, because the updated mode was cached but not > committed to stable storage. Filesystem bugs can be nasty. The S_ISLNK check that you put in bypasses this dark/fuzzy area in the kern

Re: fchmodat with AT_SYMLINK_NOFOLLOW

2020-02-16 Thread Bruno Haible
On 2020-02-08 I wrote: > 1) Improve the cross-compilation guesses. The result of the > "fchmodat+AT_SYMLINK_NOFOLLOW works on non-symlinks" test is: > - yes on kFreeBSD/glibc, Hurd/glibc, FreeBSD 12, AIX 7.2, Solaris 11, Haiku, > - no on Linux/glibc, Cygwin 2.9. A similar improvement can be do

Re: [PATCH] fchmodat, lchmod: port to buggy Linux filesystems

2020-02-16 Thread Paul Eggert
On 2/16/20 9:24 AM, Bruno Haible wrote: In this case: - On ext4, btrfs, jfs, xfs: mode changed, but error "Operation not supported". - On reiserfs: mode changed, success. Thanks for checking. I hope all this stuff is worked around by the latest patch. One other possible bug is that t

Re: [PATCH] fchmodat, lchmod: port to buggy Linux filesystems

2020-02-16 Thread Bruno Haible
I wrote: > But what I observe is that the behaviour is the same on all major file > systems on Linux. > > Tested on Linux 5.3.7 (fc31), with the trivial program below, on > - ext4 > - btrfs > - jfs > - reiserfs > - xfs This are different when using the code which goes through the /proc

Re: fstrcmp: memory is not reclaimed on exit

2020-02-16 Thread Bruno Haible
Hi Akim, Sorry for the delay. > > Do the threads still exist at the moment valgrind does its inventory of > > left- > > over memory? > > I don't know when it runs its stuff, but I expect, given where it stands, > that it does it as the latest possible instant. > > > In particular: > > - Did y