Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Long file names not supported #55

Closed
driusan opened this issue Jul 20, 2018 · 8 comments
Closed

Long file names not supported #55

driusan opened this issue Jul 20, 2018 · 8 comments
Labels
enhancement git test suite Issues identified by the real git test suite

Comments

@driusan
Copy link
Owner

driusan commented Jul 20, 2018

Reading a long file name ( >= 0xFFF) fails to be read into the index with a panic, because it doesn't know how many characters to skip over to get to the next index entry.

@driusan driusan added enhancement git test suite Issues identified by the real git test suite labels Jul 20, 2018
@sirnewton01
Copy link
Collaborator

I tried reproducing the scenario on Mac with the latest dgit and I get this message.

Mode does not match type: 100644 257cc5642cb1a054f08cc83f2d943e56fd3ebe99 0 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa*...*q

I'm not sure if the panic is hidden underneath or if I'm seeing a different case because of Mac.

@sirnewton01
Copy link
Collaborator

sirnewton01 commented Jul 20, 2018

I get this panic after I add using official git and I try dgit to read the status.

$ ../dgit status
panic: TODO: I can't handle such long names yet

goroutine 1 [running]:
github.com/driusan/dgit/git.ReadIndexEntry(0xc4200b2038, 0x2, 0x2, 0xc4200a0cc0)
/Users/cmcgee/go/src/github.com/driusan/dgit/git/index.go:168 +0x25c
github.com/driusan/dgit/git.GitDir.ReadIndex(0xc4200b0180, 0x35, 0x0, 0x0, 0x0)
/Users/cmcgee/go/src/github.com/driusan/dgit/git/index.go:106 +0x304
github.com/driusan/dgit/git.StatusLong(0xc4200a2d50, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0xc4200a61e0, 0x22, 0x0, ...)
/Users/cmcgee/go/src/github.com/driusan/dgit/git/status.go:124 +0x75
github.com/driusan/dgit/git.Status(0xc4200a2d50, 0x100000000, 0x301, 0x13403c9, 0x7, 0x0, 0x0, 0x0, 0xc420063a00, 0x1012368, ...)
/Users/cmcgee/go/src/github.com/driusan/dgit/git/status.go:73 +0x320
github.com/driusan/dgit/cmd.Status(0xc4200a2d50, 0xc4200b6010, 0x0, 0x0, 0x1, 0x0)
/Users/cmcgee/go/src/github.com/driusan/dgit/cmd/status.go:96 +0x766
main.main()
/Users/cmcgee/go/src/github.com/driusan/dgit/main.go:242 +0x3630

@driusan
Copy link
Owner Author

driusan commented Jul 20, 2018

Yeah, the case isn't handled and has an explicit panic. I tried just reading blocks of 8 bytes until one ended in nil (see comment above the panic in normal sized case), but it led to a corrupt index, so there's slightly more to it than that, but that's definitely at least part of it.

@sirnewton01
Copy link
Collaborator

I tried some variations of ignoring the nameLength and just read in the name bytes until encountering a null byte and also accounting for the 8 byte (+4, no +4) boundaries, but no success so far. I can't seem to find any index file format description that covers insanely long file names. I mean, even Linux and Mac don't support file names with this length. I'm tempted to skip over this one test in the basic suite since it seems like such an edge case.

@sirnewton01
Copy link
Collaborator

Although, this doesn't address this particular enhancement request, I have added a patch that will skip the test for now as part of PR #61

@sirnewton01
Copy link
Collaborator

@sirnewton01
Copy link
Collaborator

When someone looks at this please remove the GIT_IGNORE_TESTS entry in .travis.yml for it "t0000.77" so that the test can verify the long filename support.

driusan added a commit that referenced this issue Jul 22, 2018
Add support for the update-index --index-info variant where
the format of stdin is that of "git ls-files -s"

Fixes #55
driusan added a commit that referenced this issue Jul 22, 2018
Add support for the update-index --index-info variant where
the format of stdin is that of "git ls-files -s"

Fixes #55
@driusan
Copy link
Owner Author

driusan commented Jul 22, 2018

Should be fixed by #68

driusan added a commit that referenced this issue Jul 22, 2018
Add support for the update-index --index-info variant where
the format of stdin is that of "git ls-files -s"

Fixes #55
driusan added a commit that referenced this issue Jul 22, 2018
Add support for the update-index --index-info variant where
the format of stdin is that of "git ls-files -s"

Fixes #55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement git test suite Issues identified by the real git test suite
Projects
None yet
Development

No branches or pull requests

2 participants