pkgsrc-Bugs archive

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

Re: pkg/29152: pkgfind patch for linux and openbsd



The following reply was made to PR pkg/29152; it has been noted by GNATS.

From: Peter Postma <peter%pointless.nl@localhost>
To: "Julio M. Merino Vidal" <jmmv84%gmail.com@localhost>
Cc: gnats-bugs%netbsd.org@localhost, pkgsrc-bugs%netbsd.org@localhost,
        jschauma%netbsd.org@localhost
Subject: Re: pkg/29152: pkgfind patch for linux and openbsd
Date: Sun, 30 Jan 2005 13:07:57 +0100

 On Sat, Jan 29, 2005 at 10:09:50PM +0100, Julio M. Merino Vidal wrote:
 > On Sat, 2005-01-29 at 16:41 +0000, pancake%phreaker.net@localhost wrote:
 > >  
 > > +#if __linux__ || __OpenBSD__
 > > +char *name=NULL;
 > > +char *getprogname()
 > > +{
 > > +       return name;
 > > +}
 > > +void setprogname(char *progname)
 > > +{
 > > +       name=progname;
 > > +}
 > > +#endif
 > > +
 > >  int
 > >  main(int argc, char *argv[])
 > >  {
 > 
 > [I'm mailing the software author directly too]
 > 
 > This is wrong, because many other systems will still fail.  You'd have
 > to add a configure script, which I think is not worth the effort.
 > 
 > The program should simply be changed to not use getprogname nor
 > setprogname at all.  This is _trivial_ to do (simply removing the
 > last getprogname() call), and I don't know why the original code uses
 > them (because it's hardcoding the program name anyway) -- well, being
 > NetBSD friendly was probably the reason ;)
 > 
 > (Besides, your patch does not respect the current style in the code.)
 > 
 
 [Added jschauma to cc]
 
 jschauma@ recently added set/getprogname() to make it more portable.
 But if these functions aren't available outside NetBSD then I don't see
 how it would be more portable.
 
 I see a few ways of fixing this:
 1) get rid of set/getprogname and hardcode it in the usage, as jmmv suggested.
 2) revert the set/getprogname changes and use extern char *__progname again.
    (but will this work everywhere? e.g. IRIX?)
 3) add libnbcompat to systems that don't have set/getprogname.
 
 Personally, I would prefer 2) and then 1).
 
 And also, if libnbcompat is only needed for err(1) and warn(1), maybe we
 would be better off by fixing this in the code (by using fprintf/exit combo)
 and then get rid of libnbcompat.
 
 I've attached a diff that attempts to make it more portable, I would
 appreciate if you could test it on a non-NetBSD system.
 
 -- 
 Peter Postma
 



Home | Main Index | Thread Index | Old Index