diff -uNr a/vtools/manifest b/vtools/manifest --- a/vtools/manifest 1f6a6754f578117a08bc3b4428801c6dbcfd04e5266de39188dc9401ed1b2cf0d33d41a47fb37480ccae92e3a5d4adde71b398f538a6d1e92effb23801b584d8 +++ b/vtools/manifest 85d3b17315823804d142fb61459960669d05122568f6d463e0252d48d9d9c12f4a6bb9b3e92072d2123e4e66a7a84359cff24d7b6d1646972d6c844a0016e454 @@ -9,3 +9,4 @@ 543200 phf vtools_ksum Ksum standalone keccak hasher 547300 bvt vtools_tempfile_standalone_notmp Standalone temporary file generation code; creates temporary files in the vpatch work directory. 584341 bvt vdiff_blockwise_read Fix stack overflow in vdiff when hashing large files. +589066 bvt vtools_fixes_rootdir_files Fix creation of files in the vtree root. Fix handling of empty vpatches. diff -uNr a/vtools/src/vpatch.adb b/vtools/src/vpatch.adb --- a/vtools/src/vpatch.adb 11c17fedc3c0442c3ca93589a47f5fdc4b9ab3bab4361a96cbff4bbb15e031d44bfeceed59e5ea6942f552fca67214c3fc9d956779f77b8a0e7432ca609f779f +++ b/vtools/src/vpatch.adb c4fa36a0508048691ea823a57b90de3bd895f10c36150fa990983ae3996eadcd1ac8a25e9d4ececfc8b41af9a0e7e29ac5382959bf7624fad8185a350c2b82c5 @@ -26,19 +26,15 @@ return S(S'First..S'First+Prefix'Length-1) = Prefix; end; - function Path_Prefix(Pathname: String; - Suffix: Positive) return String is + function Directory_Name(Pathname: String) return String is Pos: Natural := Pathname'Last; begin - for I in 1..Suffix loop - Pos := Ada.Strings.Fixed.Index(Pathname, "/", - From => Pos, - Going => Ada.Strings.Backward); - if Pos = 0 then - return Pathname; - end if; - Pos := Pos - 1; - end loop; + Pos := Ada.Strings.Fixed.Index(Pathname, "/", + From => Pos, + Going => Ada.Strings.Backward); + if Pos = 0 then + return Dirs.Current_Directory; + end if; return Pathname(Pathname'First .. Pos); end; @@ -623,8 +619,8 @@ Close(In_F); Dirs.Delete_File(To_F_Name); else - if not Dirs.Exists(Path_Prefix(To_F_Name, 1)) then - Dirs.Create_Path(Path_Prefix(To_F_Name, 1)); + if not Dirs.Exists(Directory_Name(To_F_Name)) then + Dirs.Create_Path(Directory_Name(To_F_Name)); end if; end if; case Op is @@ -651,6 +647,7 @@ begin Read_Loop: loop + exit Read_Loop when End_Of_File; declare S: String := Get_Line; begin @@ -659,7 +656,6 @@ H: Header := Get_Header; begin Process_Hunks_For_Header(H); - exit Read_Loop when End_Of_File; end; else Put_Line("Prelude: " & S);