Bug#750497: don't use sysconf(_SC_SYMLOOP_MAX), please

Adam Borowski kilobyte at angband.pl
Thu Jun 5 07:34:04 UTC 2014


On Thu, Jun 05, 2014 at 07:23:48AM +0000, Mike Gabriel wrote:
> On  Mi 04 Jun 2014 01:07:21 CEST, Adam Borowski wrote:
> >I'm afraid this patch doesn't work.  It makes the code compile, but if you
> >try to execute it, it will assume any symlinks form a loop.
> >
> >The relevant snippet is:
> >                                if (++num_links > MAXSYMLINKS)
> >                                {
> >                                        errno = ELOOP;
> >                                        goto error;
> >                                }
> >which fails to execute if the returned value is -1.  Linux' headers use an
> >arbitrary bogus value of MAXSYMLINKS 20 to let old code work, Hurd guys
> >decided that it's better for wrong code to fail at compilation stage.
> >It's the same story as MAX_PATH.
> >
> >sysconf(_SC_SYMLOOP_MAX) returns -1 on Linux as well.
> 
> with so much background knowledge on this, do you think you can
> provide a patch for the patch?
> 
> Should we simply set MAXSYMLINKS to this value of 20 instead?


I don't see much gain in trying to exhaust the system limit on pathological
symlink-to-symlink scenarios, so yeah, just setting this to 20 sounds a good
idea to me.

-- 
Gnome 3, Windows 8, Slashdot Beta, now Firefox Ribbon^WAustralis.  WTF is going
on with replacing usable interfaces with tabletized ones?



More information about the pkg-mate-team mailing list