[2795] in BarnOwl Developers

home help back first fref pref prev next nref lref last post

Re: [PATCH 1/2] Fixed :unsub to make it work if ~/.zephyr.subs is a symlink (trac 133)

daemon@ATHENA.MIT.EDU (Karl Ramm)
Mon Nov 15 21:59:42 2010

From: Karl Ramm <kcr@1ts.org>
To: Jason Gross <jasongross9@gmail.com>
Cc: David A Benjamin <davidben@MIT.EDU>, Kevin Chen <kchen@MIT.EDU>,
        barnowl-dev@MIT.EDU
Date: Mon, 15 Nov 2010 21:59:41 -0500
In-Reply-To: <AANLkTinRf6R9mDKJh=K6pxpcZdSvHyuUdUcMJgU1UDd-@mail.gmail.com>
	(Jason Gross's message of "Mon, 15 Nov 2010 21:21:02 -0500")

Jason Gross <jasongross9@gmail.com> writes:

> So should I rewrite the code to use readlink instead?  If so, is there a
> problem with naming the code readlink_malloc, or should I give it a name
> with an owl_ prefix to avoid conflicts?  Is an inline citation of
> http://www.gnu.org/s/libc/manual/html_node/Symbolic-Links.html sufficient?

I would rewrite the code entirely, because we probably don't want the gnu "free"
documentation license infecting our code.

kcr

> -Jason
>
> On Mon, Nov 15, 2010 at 5:55 PM, Karl Ramm <kcr@1ts.org> wrote:
>
>> Readlink is a syscall available on any UNIX with symlinks, which is any
>> you're going to be running barnowl on.
>>
>> kcr
>> Jason Gross <jasongross9@gmail.com> writes:
>>
>> > Where do I find information about where a function is supported?
>> >
>> > I found canonicalize_file_name at
>> > http://www.gnu.org/s/libc/manual/html_node/Symbolic-Links.html, which I
>> > found by searching google (
>> >
>> http://www.google.com/search?sourceid=chrome&ie=UTF-8&q=resolve+symbolic+link+c
>> ).
>> >  It also gave the function readlink and the code
>> >
>> > char *
>> > readlink_malloc (const char *filename)
>> > {
>> >   int size = 100;
>> >   char *buffer = NULL;
>> >
>> >   while (1)
>> >     {
>> >       buffer = (char *) xrealloc (buffer, size);
>> >       int nchars = readlink (filename, buffer, size);
>> >       if (nchars < 0)
>> >         {
>> >           free (buffer);
>> >           return NULL;
>> >         }
>> >       if (nchars < size)
>> >         return buffer;
>> >       size *= 2;
>> >     }
>> > }
>> >
>> > Is this a GNUism, or is readlink generally available?  Should we use this
>> > instead?  (I think Python uses readlink for its realpath.)
>> >
>> > -Jason
>> >
>> > On Mon, Nov 15, 2010 at 5:14 PM, David A Benjamin <davidben@mit.edu>
>> wrote:
>> >
>> >> On Mon, 15 Nov 2010, David A Benjamin wrote:
>> >>
>> >>  On Mon, 15 Nov 2010, Kevin Chen wrote:
>> >>>
>> >>>  On Mon, 15 Nov 2010, Karl Ramm wrote:
>> >>>>
>> >>>>  David A Benjamin <davidben@MIT.EDU> writes:
>> >>>>>
>> >>>>>  The man pages says it's equivalent to realpath(path, NULL)
>> >>>>>> which... doesn't appear to be a GNUism?
>> >>>>>>
>> >>>>>> We can also add another AC_REPLACE_FUNCS, but they're annoying.
>> >>>>>>
>> >>>>>> David
>> >>>>>>
>> >>>>>
>> >>>>> It's in POSIX 2001 so we.. probably get to point and laugh if someone
>> >>>>> doesn't have it?
>> >>>>>
>> >>>>
>> >>>> My manpage (for realpath) says that passing NULL as the second
>> argument
>> >>>> is a non-standard glibc extension.
>> >>>>
>> >>>>
>> >>> Lovely. Meh, we can allocate a PATH_MAX-sized buffer. Not terribly
>> >>> exciting.
>> >>>
>> >>>
>> >> Err, on second thought, reading all the NOTES in my version of the man
>> >> page, can I run away screaming now?
>> >>
>> >> Maybe glib has an implementation that isn't awful.
>> >>
>> >> David
>> >>
>>

home help back first fref pref prev next nref lref last post