Re: [fossil-users] crlf-glob

2017-05-16 Thread Arjen Markus

From: fossil-users [mailto:[email protected]] On Behalf 
Of Stephan Beal
Sent: Tuesday, May 16, 2017 11:09 AM
To: Fossil SCM user's discussion
Subject: Re: [fossil-users] crlf-glob

On Tue, May 16, 2017 at 12:16 AM, Thomas  wrote:
On 2017-05-15 23:09, Warren Young wrote:
On May 15, 2017, at 3:27 PM, Thomas  wrote:

Does it really matter in the 21st century if a line is terminated by CR, LF, or 
CR/LF anymore?

Notepad.exe in Windows 10 Creator's Edition still only works properly with 
CR+LF.  Since that's the default handler for *.txt on Windows, yes, line ending 
type still matters for any cross-platform project.

So, after editing a file that belongs to your project with Notepad on Windows, 
would you expect an SCM complaining about it when you commit?

I wouldn't.


Real-life case: a developer on a banking project i worked on edited a shell 
script with notepad and checked it in (without having tested it). The SCM did 
not complain about Notepad-injected \r characters. After deployment on the live 
system this script started exiting with "bad interpreter". The reason, which we 
discovered only after opening the script in Emacs, which shows \r as ^M, was 
that notepad had mangled it, changing the first line to:

#!/bin/sh^M

The ^M (\r) is just another character for most Unix tools, and the system was 
treating the \r as part of the shell's name, which of course didn't work.


Warning: one of my favourite complaints ahead ...
Well, actually it gets worse. The CRLF is interpreted as a line separator, not 
an end-of-line marker. The last line may therefore miss that marker. So there 
is no distinction between a "complete" file and a truncated file.

And then there is the BOM, which editors on Windows sometimes insert ...

Regards,

Arjen
DISCLAIMER: This message is intended exclusively for the addressee(s) and may 
contain confidential and privileged information. If you are not the intended 
recipient please notify the sender immediately and destroy this message. 
Unauthorized use, disclosure or copying of this message is strictly prohibited. 
The foundation 'Stichting Deltares', which has its seat at Delft, The 
Netherlands, Commercial Registration Number 41146461, is not liable in any way 
whatsoever for consequences and/or damages resulting from the improper, 
incomplete and untimely dispatch, receipt and/or content of this e-mail.
___
fossil-users mailing list
[email protected]
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users


Re: [fossil-users] crlf-glob

2017-05-16 Thread Stephan Beal
On Tue, May 16, 2017 at 12:16 AM, Thomas  wrote:

> On 2017-05-15 23:09, Warren Young wrote:
>
>> On May 15, 2017, at 3:27 PM, Thomas  wrote:
>>
>>>
>>> Does it really matter in the 21st century if a line is terminated by CR,
>>> LF, or CR/LF anymore?
>>>
>>
>> Notepad.exe in Windows 10 Creator’s Edition still only works properly
>> with CR+LF.  Since that’s the default handler for *.txt on Windows, yes,
>> line ending type still matters for any cross-platform project.
>>
>
> So, after editing a file that belongs to your project with Notepad on
> Windows, would you expect an SCM complaining about it when you commit?
>
> I wouldn't.



Real-life case: a developer on a banking project i worked on edited a shell
script with notepad and checked it in (without having tested it). The SCM
did not complain about Notepad-injected \r characters. After deployment on
the live system this script started exiting with "bad interpreter". The
reason, which we discovered only after opening the script in Emacs, which
shows \r as ^M, was that notepad had mangled it, changing the first line to:

#!/bin/sh^M

The ^M (\r) is just another character for most Unix tools, and the system
was treating the \r as part of the shell's name, which of course didn't
work.


-- 
- stephan beal
http://wanderinghorse.net/home/stephan/
"Freedom is sloppy. But since tyranny's the only guaranteed byproduct of
those who insist on a perfect world, freedom will have to do." -- Bigby Wolf
___
fossil-users mailing list
[email protected]
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users


Re: [fossil-users] crlf-glob

2017-05-15 Thread Warren Young
On May 15, 2017, at 4:16 PM, Thomas  wrote:
> 
> On 2017-05-15 23:09, Warren Young wrote:
>> On May 15, 2017, at 3:27 PM, Thomas  wrote:
>>> 
>>> Does it really matter in the 21st century if a line is terminated by CR, 
>>> LF, or CR/LF anymore?
>> 
>> Notepad.exe
> 
> So, after editing a file that belongs to your project with Notepad on 
> Windows, would you expect an SCM complaining about it when you commit?

If I knew I was building a project where the *.txt files needed to be readable 
on all common platforms, including Windows, I’d save them with CRLF line 
endings and add a *.txt line in .fossil-settings/crlf-glob.  That way, the text 
editors on Linux, macOS, and such won’t molest the CRLF endings, and if the 
Windows-based end users of the project haven’t associated something decent with 
*.txt, they’ll see the file as-intended and their text editor will save the 
file back out with CRLF, which is fine.

This policy means you can save most every other text file in the project with 
LF line endings since those are probably only associated with decent text 
editors on Windows (e.g. *.c, *.md, *.xml…) so those line endings won’t be 
molested, either.

The core of this philosophy is to cause the files in the repository to obey the 
principle of least surprise, with the burden of understanding what’s going on 
being placed on the person(s) maintaining the repository.

The alternative, where Fossil just tries to do magic but dumps a burden on the 
end users of the repository when the heuristics fail is fundamentally 
backwards.  It burdens the masses for the sake of the few.

Maybe you’d like to explain how the line endings got screwed up in your 
project?  
___
fossil-users mailing list
[email protected]
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users


Re: [fossil-users] crlf-glob

2017-05-15 Thread Thomas

On 2017-05-15 23:09, Warren Young wrote:

On May 15, 2017, at 3:27 PM, Thomas  wrote:


Does it really matter in the 21st century if a line is terminated by CR, LF, or 
CR/LF anymore?


Notepad.exe in Windows 10 Creator’s Edition still only works properly with 
CR+LF.  Since that’s the default handler for *.txt on Windows, yes, line ending 
type still matters for any cross-platform project.


So, after editing a file that belongs to your project with Notepad on 
Windows, would you expect an SCM complaining about it when you commit?


I wouldn't.


___
fossil-users mailing list
[email protected]
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users


Re: [fossil-users] crlf-glob

2017-05-15 Thread Warren Young
On May 15, 2017, at 3:27 PM, Thomas  wrote:
> 
> Does it really matter in the 21st century if a line is terminated by CR, LF, 
> or CR/LF anymore?

Notepad.exe in Windows 10 Creator’s Edition still only works properly with 
CR+LF.  Since that’s the default handler for *.txt on Windows, yes, line ending 
type still matters for any cross-platform project.
___
fossil-users mailing list
[email protected]
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users