Opened 11 years ago
Closed 8 years ago
#21046 closed Bug (wontfix)
django-admin.py always creates files with Unix line endings
Reported by: | Florian Sening | Owned by: | nobody |
---|---|---|---|
Component: | Core (Management commands) | Version: | 1.5 |
Severity: | Normal | Keywords: | |
Cc: | Ramiro Morales | Triage Stage: | Accepted |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
Versions prior Django 1.5 created files with machine dependent line endings. With Django 1.5 and above the line endings suddenly changed to always Unix (LF). You can simply check this if you just try startproject
and then have a look at the project files.
I could not find anything related to this but I consider this a bug because generated files should be like every other file on your machine - in the native newline format of your platform.
Attachments (1)
Change History (11)
comment:1 by , 11 years ago
comment:2 by , 11 years ago
Triage Stage: | Unreviewed → Accepted |
---|
comment:3 by , 11 years ago
I think I got it. The fix for #18091 in 3afb5916b215c79e36408b729c9516bc435f5cb7 introduced this bug. Beside that another bug #19397 was introduced which later was fixed in baae4b818778180fedfcfcfc7aa77acfb9b237fb. I still have to figure out how to fix this without breaking the other patches. I'll try your suggestion.
by , 10 years ago
Attachment: | 21046-1.diff added |
---|
comment:4 by , 10 years ago
I've just attached the patch to test on a non-Unix machine and which might solve this bug.
comment:6 by , 8 years ago
I don't know how important this is these days. I think version control programs like Git usually normalize line endings anyway.
Another consideration (I think) is that this will apply only to Python files that the template commands are rewriting, not to any other text-based files.
Does makemigrations
(and any other management commands that write files) already have this behavior?
Maybe there are good reasons to make the change, but I just wanted to ask about these points.
comment:7 by , 8 years ago
Right, I think Windows user should speak now.
comment:10 by , 8 years ago
Resolution: | → wontfix |
---|---|
Status: | new → closed |
Feedback from Mike Dewhirst:
I haven't had any such problems. I develop on Windows and deploy on Linux. Editors and repos look after all that. If I did have a problem I would consider it my own responsibility to choose a different set of tools to resolve it. Not a Django issue IMO.
It might be a regression added during fix of #19397 (c9a47fb379cab4c0fe9be27c9924236e75327bd0). I do not have access to non-Unix machines, so I'm not able to test this, but it might be worth testing if only using binary mode when the file is detected as a non text file could solve this issue.