[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATH] grub-mkrelpath
From: |
Felix Zielcke |
Subject: |
Re: [PATH] grub-mkrelpath |
Date: |
Sun, 01 Nov 2009 16:39:42 +0100 |
Am Samstag, den 29.08.2009, 09:51 +0200 schrieb Felix Zielcke:
> Am Samstag, den 29.08.2009, 01:55 +0200 schrieb Robert Millan:
> > On Fri, Aug 28, 2009 at 07:58:39PM +0200, Felix Zielcke wrote:
> > > +#else /* ! HAVE_REALPATH */
> > > + grub_util_warn ("grub-mkrelpath might not work on your OS correctly.");
> > > + /* make relative path absolute. */
> > > + if (*path != '/')
> > > + {
> > > + len = 1024;
> > > + buf2 = xmalloc (len);
> > > + do
> > > + {
> > > + buf2 = getcwd (buf2, len);
> > > + if (buf2 == NULL)
> > > + {
> > > + if (errno != ERANGE)
> > > + grub_util_error ("can not get current working directory");
> > > + else
> > > + len *= 2;
> > > + buf2 = xrealloc (buf2, len);
> > > + }
> > > + } while (buf2 == NULL);
> > > + buf = xmalloc (strlen (path) + strlen (buf2) + 1);
> > > + strcpy (buf, buf2);
> > > + strcat (buf, "/");
> > > + strcat (buf, path);
> > > + }
> > > + else
> > > + buf = strdup (path);
> > > +#endif /* ! HAVE_REALPATH */
> >
> > Please can you leave this part out? realpath() is POSIX, so it should be
> > present in all systems we support, and if it isn't, we should be using a
> > complete implementation from Gnulib instead, but we don't need to worry
> > about this untill/unless someone reports it as a problem.
>
> Ok, but should I then check in configure.ac that realpath is required or
> something else?
> Or should I just assume that realpath is always avaible?
For now I assume that realpath is avaible.
> > > + p = strrchr (buf, '/');
> > > + if (p == NULL)
> > > + grub_util_error ("FIXME: no / in buf.
> > > (make_system_path_relative_to_its_root)");
> >
> > Does this ever happen?
>
> As Vladimir said, it shouldn't ever happen, but I thought it would be
> better to check for this explicitly instead of core dumping in that
> case.
I added now a comment that this shouldn't ever happen.
New version avaible at
bzr+ssh://bzr.savannah.gnu.org/grub/people/fzielcke/mkrelpath
--
Felix Zielcke
Proud Debian Maintainer and GNU GRUB developer
- Re: [PATH] grub-mkrelpath,
Felix Zielcke <=
- Re: [PATH] grub-mkrelpath, Robert Millan, 2009/11/01
- Re: [PATH] grub-mkrelpath, Felix Zielcke, 2009/11/02
- Re: [PATH] grub-mkrelpath, rubisher, 2009/11/03
- Re: [PATH] grub-mkrelpath, Felix Zielcke, 2009/11/03
- Re: [PATH] grub-mkrelpath, rubisher, 2009/11/03
- Re: [PATH] grub-mkrelpath, Felix Zielcke, 2009/11/03
- Re: [PATH] grub-mkrelpath, rubisher, 2009/11/04
- Re: [PATH] grub-mkrelpath, Felix Zielcke, 2009/11/04