This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Ada] Normalize_Pathname with unresolved reference directory


This change removes an unnecessary limitation whereby Normalize_Pathname
would not accept an unresolved path name as the reference directory, and
would furthermore return incorrect results, rather than an error diagnostic,
in the case where input did not comply with this limitation.

The following test case must produce the indicated output:

$ gnatmake -q resolve_against_dotdot
$ ./resolve_against_dotdot
/a/b/dir
/a/b/dir
/tmp/bar/dir

with Ada.Text_IO; use Ada.Text_IO;
with GNAT.OS_Lib; use GNAT.OS_Lib;

procedure Resolve_Against_DotDot is
begin
   Put_Line (Normalize_Pathname ("../dir", "/a/b/c"));
   Put_Line (Normalize_Pathname ("../dir", "/a/b/c/SUB/.."));
   Put_Line (Normalize_Pathname ("/tmp/foo/../bar/dir", "/a/b/c/SUB/.."));
end;

Tested on x86_64-pc-linux-gnu, committed on trunk

2015-11-18  Thomas Quinot  <quinot@adacore.com>

	* s-os_lib.ads, s-os_lib.adb(Normalize_Pathname): Support the case of
	an unresolved Directory argument, by recursively resolving it
	against the current dir.

Attachment: difs
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]