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
Does this issue reproduce with the latest release?
duno
What operating system and processor architecture are you using (go env)?
Windows 10 64 bit
go env Output
$ go env
What did you do?
Hi! I have a list of *.yml files, im archive this files to one tar file, but one or two of them after process have different extension after tar is done, why?
What did you expect to see?
.yml extension
What did you see instead?
.yml0000777 extension
package main
import (
"archive/tar"
"io/ioutil"
"log"
"os"
)
func main() {
// Create and add some files to the archive.
f, err := os.Create("test.tar")
if err != nil {
panic(err)
}
defer f.Close()
tw := tar.NewWriter(f)
defer tw.Close()
file, err := os.Open("puma_Она_Обувь_Кроссовки, сникеры_На каждый день (Lifestyle).yml")
if err != nil {
panic(err)
}
defer file.Close()
fileInfo, err := file.Stat()
if err != nil {
log.Println(err)
}
hdr := &tar.Header{
Name: file.Name(),
Mode: 0777,
Size: fileInfo.Size(),
Format: tar.FormatGNU,
}
if err := tw.WriteHeader(hdr); err != nil {
log.Fatal(err)
}
bin, err := ioutil.ReadAll(file)
if err != nil {
log.Println(err)
}
if _, err := tw.Write(bin); err != nil {
log.Fatal(err)
}
if err := tw.Close(); err != nil {
log.Fatal(err)
}
}
the code with .yml (xml) file im trying to tar without change its extension tartest.zip
The text was updated successfully, but these errors were encountered:
This does not seem to be an issue with Go's implementation of TAR. Using GNU tar v1.30 and bsdtar v3.4.0, both are able to parse a TAR archive produced by Go v1.17 with the correct filename. Rather, it seems to be an issue with the program trying to read this.
dsnet
changed the title
tar package changes file extension
archive/tar: incorrect file extension
Sep 9, 2021
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
duno
What operating system and processor architecture are you using (
go env
)?Windows 10 64 bit
go env
OutputWhat did you do?
Hi! I have a list of *.yml files, im archive this files to one tar file, but one or two of them after process have different extension after tar is done, why?
What did you expect to see?
.yml extension
What did you see instead?
.yml0000777 extension
the code with .yml (xml) file im trying to tar without change its extension
tartest.zip
The text was updated successfully, but these errors were encountered: