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

OSX template containing \0 instead of \r #155

Closed
nicoespeon opened this issue Jul 30, 2015 · 6 comments
Closed

OSX template containing \0 instead of \r #155

nicoespeon opened this issue Jul 30, 2015 · 6 comments
Labels
Milestone

Comments

@nicoespeon
Copy link

Hi there!

I spotted something that might be wrong with the OSX .gitgnore template.

Here is the generated file I've got:

# Created by .ignore support plugin (hsz.mobi)

### OSX template
.DS_Store
.AppleDouble
.LSOverride

# Icon must end with two \r
Icon

# Thumbnails
._*

# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns

# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk

The error lies here:

# Icon must end with two \r
Icon

Actually, it seems that there're 2 \0 characters instead of 2 \r, which might break things as I ran into some issues with git-related tools.

I'm not sure it was expected so I'm reporting as it looks like an issue.

For comparison, here is the diff with the http://www.gitignore.io version (which is on the left):

capture d ecran 2015-07-30 a 09 05 02

Thanks a lot for your useful plugin by the way 👍

@hsz
Copy link
Member

hsz commented Jul 30, 2015

@nicoespeon Thank you for the reporting this issue.

In fact I didn't expect any problems with \0.
Do we really need \r character in the generated file Or we can just remove all \r ?

@hsz hsz added the bug label Jul 30, 2015
@hsz hsz added this to the 1.2 milestone Jul 30, 2015
@nicoespeon
Copy link
Author

I guess \r are here to prevent matching an eventual existing Icon file which is not the one from the OS, how unlikely it could be.

I guess the original template is this one: https://github.com/github/gitignore/blob/master/Global/OSX.gitignore

But the 2 \r of this one are parsed into \0 somewhere. I'm not sure but that might be related to a57acd4, which was solving issue #13.

I don't have any clue in mind on how to solve this. But I guess that, pragmatically, having Icon without any \r may be less likely to cause troubles than Icon with \0 which may break things regarding tools you use. What do you think?

@hsz
Copy link
Member

hsz commented Jul 30, 2015

Nice catch with this #13 issue. ;-)

I don't see any particular reason to keep \r in the generated content for now. The simplest way will be just removing them - for now there were no \r anyway.

@nicoespeon
Copy link
Author

Sounds a legitimate hotfix indeed 👍

@hsz
Copy link
Member

hsz commented Jul 30, 2015

I cannot allow \r\r to appears in the editor because of #13 regresion (I've just tested it again right now). It can be replaced to \r\n\r\n but it won't be the original Icon\r\r then so there will be no profit.

hsz added a commit that referenced this issue Jul 30, 2015
@nicoespeon
Copy link
Author

Yep, I don't see any workaround neither since there can't be \r\r. Hence the best solution is removing them as you said 😃

@hsz hsz closed this as completed Jul 30, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants