All of lore.kernel.org
 help / color / mirror / Atom feed
From: Felix Zielcke <fzielcke@z-51.de>
To: The development of GRUB 2 <grub-devel@gnu.org>
Subject: Re: [PATH] grub-mkrelpath
Date: Sat, 29 Aug 2009 09:51:15 +0200	[thread overview]
Message-ID: <1251532275.2624.2.camel@fz.local> (raw)
In-Reply-To: <20090828235514.GA17856@thorin>

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?

> > +      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.


-- 
Felix Zielcke
Proud Debian Maintainer




  parent reply	other threads:[~2009-08-29  7:51 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-28 12:53 [PATH] grub-mkrelpath Felix Zielcke
2009-08-28 16:28 ` Robert Millan
2009-08-28 17:58   ` Felix Zielcke
2009-08-28 23:55     ` Robert Millan
2009-08-29  0:58       ` Vladimir 'phcoder' Serbinenko
2009-08-29  7:51       ` Felix Zielcke [this message]
2009-11-01 15:39         ` Felix Zielcke
2009-11-01 22:04           ` Robert Millan
2009-11-02  8:54             ` Felix Zielcke
2009-11-02 13:45               ` Robert Millan
2009-11-02 15:41                 ` Felix Zielcke
2009-11-03 10:21               ` rubisher
2009-11-03 10:33                 ` Felix Zielcke
2009-11-03 13:51                   ` rubisher
2009-11-03 14:09                     ` Felix Zielcke
2009-11-04  9:55                       ` rubisher
2009-11-04 11:07                         ` Felix Zielcke
2009-11-04 14:59                           ` rubisher
2009-11-04 15:55                             ` Felix Zielcke
2009-11-11 22:43           ` Felix Zielcke

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1251532275.2624.2.camel@fz.local \
    --to=fzielcke@z-51.de \
    --cc=grub-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.