bug-groff
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [bug #55449] [PATCH] Use FILENAME_MAX in maxfilename.cpp


From: Carsten Kunze
Subject: Re: [bug #55449] [PATCH] Use FILENAME_MAX in maxfilename.cpp
Date: Wed, 21 Oct 2020 23:07:54 +0200 (CEST)

I forgot it need to compile on Windows--sorry for the noise.

> Carsten Kunze <carsten.kunze@arcor.de> hat am 21. Oktober 2020 um 21:23 
> geschrieben:
> 
> 
> How about at first using pathconf(3) with the constant _PC_NAME_MAX to 
> determine the file name length (for a specfific path) and using the constants 
> only when pathconf returns -1?
> 
> > Ingo Schwarze <INVALID.NOREPLY@gnu.org> hat am 21. Oktober 2020 um 18:43 
> > geschrieben:
> > 
> > 
> > Update of bug #55449 (project groff):
> > 
> >              Assigned to:                    None => schwarze               
> >          Planned Release:                    None => 1.23                   
> > 
> >     _______________________________________________________
> > 
> > Follow-up Comment #4:
> > 
> > The patch #45943 is not correct.
> > 
> > According to the comment at the top of src/libs/libgroff/maxfilename.cpp, 
> > what
> > the function file_name_max() wants to return is NAME_MAX.
> > 
> > If a system defines both NAME_MAX and FILENAME_MAX - which all system ought 
> > to
> > do because POSIX requires both - then the patch clobbers NAME_MAX with
> > FILENAME_MAX.  On some systems, both have different values.
> > 
> > I also suggest to use a more readable idiom avoiding nested #ifs, see the
> > attached patch 55449-schwarze.patch.
> > 
> > Also, use FILENAME_MAX only as a last-resort fallback.  It is not clear to 
> > me
> > that FILENAME_MAX has exactly the same meaning as NAME_MAX.  On some 
> > systems,
> > FILENAME_MAX is much larger than NAME_MAX, so using it does not seem 
> > perfectly
> > safe.  Then again, when nothing else is available, maybe it is still better
> > than 14.
> > 
> > Eli, can you test whether this version works for you, too?
> > 
> > (file #50036)
> >     _______________________________________________________
> > 
> > Additional Item Attachment:
> > 
> > File name: 55449-schwarze.patch           Size:1 KB
> >     <https://file.savannah.gnu.org/file/55449-schwarze.patch?file_id=50036>
> > 
> > 
> > 
> >     _______________________________________________________
> > 
> > Reply to this item at:
> > 
> >   <https://savannah.gnu.org/bugs/?55449>
> > 
> > _______________________________________________
> >   Message sent via Savannah
> >   https://savannah.gnu.org/
> > 
> >
>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]