You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Tar: ustar entries with long name unable to roundtrip #75360
When you use new UstarTarEntry(TarEntryType entryType, string entryName) there's no exception about the entryName length, so I would expect that the format could handle any name but when I try to write a name larger than 100, the chars past 100 are written to the prefix.
When you read back the entry, we concat prefix + '/' + name, which makes the name different to what you wrote.
MemoryStreamms=new();using(TarWriterwriter=new(ms,true)){TarEntryentry=newUstarTarEntry(TarEntryType.RegularFile,newstring('a',100)+newstring('b',155));Console.WriteLine("Entry name on write: "+entry.Name);// prints aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbwriter.WriteEntry(entry);}ms.Position=0;using(TarReaderreader=newTarReader(ms)){TarEntryentry=reader.GetNextEntry();Console.WriteLine("Entry name on reading: "+entry.Name);// prints bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa}
We need to align name and prefix behavior on read and write on ustar entries.
Aditionally, one way to set expectations about name lengths is to raise exceptions for names that would be truncated. For example, for V7 we can throw for names > 100 and for ustar we can throw for names > 255.
Activity
jozkee commentedon Sep 9, 2022
Moving to 8.0 as ustar is not a very popular format and the workaround is to use Pax or Gnu format instead.
kasperk81 commentedon Oct 3, 2022
fix is being backported #76322, so milestone 7?
jozkee commentedon Oct 3, 2022
@kasperk81 still needs approval to be merged into 7.0