bugmake - Bugs: bug #30312, $(abspath ...) fails with Windows...

 
 

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

Submitter:  None
Submitted:  Thu 01 Jul 2010 01:03:42 PM UTC
   
 
Severity:  3 - Normal Item Group:  Bug
Status:  Fixed Privacy:  Public
Assigned to:  eliz Open/Closed:  Closed
Component Version:  None Operating System:  MS Windows
Fixed Release:  3.82 Triage Status:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Fri 09 Jul 2010 11:42:34 AM UTC, comment #1: 

I committed a slightly different fix for this problem.

Thanks.

Eli Zaretskii <eliz>
Group Member
Thu 01 Jul 2010 01:03:42 PM UTC, original submission:  

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

Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files
file #20866:  abspath.c added by None (3KiB - text/plain - Fixed source of abspath())

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by psmith (Updated the item)
  • -email is unavailable- added by eliz (Posted a comment)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 6 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2010-07-28 psmith Fixed Release4.0 3.82
    2010-07-09 psmith StatusNone Fixed
        Assigned toNone eliz
    2010-07-09 eliz Open/ClosedOpen Closed
    2010-07-09 eliz Fixed ReleaseNone 4.0
    2010-07-01 None Attached File- Added abspath.c, #20866

    Back to the top

    Powered by Savane 3.13-b921.
    Corresponding source code