bug-make
[Top][All Lists]
Advanced

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

[bug #30312] $(abspath ...) fails with Windows UNC path (with fix)


From: anonymous
Subject: [bug #30312] $(abspath ...) fails with Windows UNC path (with fix)
Date: Thu, 01 Jul 2010 13:03:43 +0000
User-agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.2; WOW64; .NET CLR 1.1.4322; .NET CLR 2.0.50727; InfoPath.1; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)

URL:
  <http://savannah.gnu.org/bugs/?30312>

                 Summary: $(abspath ...) fails with Windows UNC path (with
fix)
                 Project: make
            Submitted by: None
            Submitted on: Thu 01 Jul 2010 01:03:42 PM UTC
                Severity: 3 - Normal
              Item Group: Bug
                  Status: None
                 Privacy: Public
             Assigned to: None
             Open/Closed: Open
         Discussion Lock: Any
       Component Version: None
        Operating System: MS Windows
           Fixed Release: None
           Triage Status: None

    _______________________________________________________

Details:

Hi,

When providing $(abspath ...) with an - already absolute - UNC paths then the
starting_direcory gets incorrectly prepended.

The fix is to replace


#ifdef HAVE_DOS_PATHS
#define IS_ABSOLUTE(n) (n[0] && n[1] == ':')
#define ROOT_LEN 3


with


#ifdef HAVE_DOS_PATHS
#define IS_ABSOLUTE(n) (n[0] && n[1] == ':' || IS_PATHSEP(n[0]) &&
IS_PATHSEP(n[1]))
#define ROOT_LEN 3


and


#ifdef HAVE_DOS_PATHS
      if (!IS_PATHSEP(apath[2]))
        {
          /* Convert d:foo into d:./foo and increase root_len.  */
          apath[2] = '.';
          apath[3] = '/';
          dest++;
          root_len++;
          /* strncpy above copied one character too many.  */
          name--;
        }
      else
        apath[2] = '/'; /* make sure it's a forward slash */
#endif


with


#ifdef HAVE_DOS_PATHS
      if (IS_PATHSEP(apath[0]))
        {
          /* Convert \\foo into //foo and decrease root_len.  */
          apath[0] = '/';
          apath[1] = '/';
          dest--;
          root_len--;
          /* strncpy above copied one character too many.  */
          name--;
        }
      else 
        {
          if (!IS_PATHSEP(apath[2]))
            {
              /* Convert d:foo into d:./foo and increase root_len.  */
              apath[2] = '.';
              apath[3] = '/';
              dest++;
              root_len++;
              /* strncpy above copied one character too many.  */
              name--;
            }
          else
            apath[2] = '/';     /* make sure it's a forward slash */
        }
#endif


Please find attached the fixed source of abspath() for your convenience.

Oliver Schmidt - oliv.schmidt(at)sap.com



    _______________________________________________________

File Attachments:


-------------------------------------------------------
Date: Thu 01 Jul 2010 01:03:42 PM UTC  Name: abspath.c  Size: 3kB   By: None
Fixed source of abspath()
<http://savannah.gnu.org/bugs/download.php?file_id=20866>

    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?30312>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

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