Bug 176991 - Normalize line terminators in jsoncpp Visual Studio files
Summary: Normalize line terminators in jsoncpp Visual Studio files
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit Misc. (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2017-09-15 02:33 PDT by Alicia Boya García
Modified: 2017-09-27 12:27 PDT (History)
7 users (show)

See Also:


Attachments
Patch (32.42 KB, patch)
2017-09-15 02:36 PDT, Alicia Boya García
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Alicia Boya García 2017-09-15 02:33:14 PDT
endings). 

Source/ThirdParty/libwebrtc/Source/third_party/jsoncpp/source/makefiles/vs71/jsoncpp.sln
Source/ThirdParty/libwebrtc/Source/third_party/jsoncpp/source/makefiles/vs71/jsontest.vcproj
Source/ThirdParty/libwebrtc/Source/third_party/jsoncpp/source/makefiles/vs71/lib_json.vcproj
Source/ThirdParty/libwebrtc/Source/third_party/jsoncpp/source/makefiles/vs71/test_lib_json.vcproj

They shouldn't because of .gitattributes [1]:

*.vcproj eol=crlf
*.vsprops eol=crlf
*.sln eol=crlf

Since they are text files, they are supposed to be stored normalized in the git
database (stored with LF terminators). Every time they are checkout out they
are converted to CRLF line endings (because that's what Visual Studio likes
working with).

Those files are not normalized in the database, and git is trying to fix that,
which is why they are "modified" even though they look the same before and
after. They are the same in the file system, but there is a line-terminator
change in the database.

These modifications are incredibly annoying as fellow WebKittens may have
already noticed many times. They appear out of nowhere as git finds this
inconsistency and it's very hard to get git to forget them. We should please it
once and for all so that we can finally work in peace.

`git show <hash>:<file>` can be used to read the raw file from the database
without any terminators altered.

In order to fix the issue we must turn this:
> git show HEAD:Source/ThirdParty/libwebrtc/Source/third_party/jsoncpp/source/makefiles/vs71/jsoncpp.sln | file -
/dev/stdin: ASCII text, with CRLF line terminators

Into this:
> git show HEAD:Source/ThirdParty/libwebrtc/Source/third_party/jsoncpp/source/makefiles/vs71/jsoncpp.sln | file -
/dev/stdin: ASCII text

Thanks to osse from #git in Freenode who helped me to figure this out.


[1] If you read `man gitattributes` you will find the following:

       text
           This attribute enables and controls end-of-line normalization. When
           a text file is normalized, its line endings are converted to LF in
           the repository. To control what line ending style is used in the
           working directory, use the eol attribute for a single file and the
           core.eol configuration variable for all text files. [...]

       [...]

       eol
           This attribute sets a specific line-ending style to be used in the
           working directory. It enables end-of-line conversion without any
           content checks, effectively setting the text attribute.

           Set to string value "crlf"
               This setting forces Git to normalize line endings for this file
               on checkin and convert them to CRLF when the file is checked
               out.

           Set to string value "lf"
               This setting forces Git to normalize line endings to LF on
               checkin and prevents conversion to CRLF when the file is
               checked out.
Comment 1 Alicia Boya García 2017-09-15 02:36:05 PDT
Created attachment 320884 [details]
Patch
Comment 2 Alicia Boya García 2017-09-15 02:38:01 PDT
> endings). 
It should read as:

The following files are stored in the git database non-normalized (with CRLF
endings).
Comment 3 WebKit Commit Bot 2017-09-15 03:33:03 PDT
Comment on attachment 320884 [details]
Patch

Rejecting attachment 320884 [details] from commit-queue.

Failed to run "['/Volumes/Data/EWS/WebKit/Tools/Scripts/webkit-patch', '--status-host=webkit-queues.webkit.org', '--bot-id=webkit-cq-02', 'land-attachment', '--force-clean', '--non-interactive', '--parent-command=commit-queue', 320884, '--port=mac']" exit_code: 2 cwd: /Volumes/Data/EWS/WebKit

Last 500 characters of output:
pp/source/makefiles/vs71/jsoncpp.sln: needs update
Source/ThirdParty/libwebrtc/Source/third_party/jsoncpp/source/makefiles/vs71/jsontest.vcproj: needs update
Source/ThirdParty/libwebrtc/Source/third_party/jsoncpp/source/makefiles/vs71/lib_json.vcproj: needs update
Source/ThirdParty/libwebrtc/Source/third_party/jsoncpp/source/makefiles/vs71/test_lib_json.vcproj: needs update
update-index --refresh: command returned error: 1

Died at /Volumes/Data/EWS/WebKit/Tools/Scripts/webkitdirs.pm line 2746.

Full output: http://webkit-queues.webkit.org/results/4556619
Comment 4 Alicia Boya García 2017-09-15 03:55:19 PDT
I feared something like this could happen...

Correct me if I'm wrong: The script is refusing the update because to its eyes,
these files have no changes.
Comment 5 Konstantin Tokarev 2017-09-15 04:00:39 PDT
Comment on attachment 320884 [details]
Patch

Clearing flags on attachment: 320884

Committed r222081: <http://trac.webkit.org/changeset/222081>
Comment 6 Konstantin Tokarev 2017-09-15 04:00:43 PDT
All reviewed patches have been landed.  Closing bug.
Comment 7 Radar WebKit Bug Importer 2017-09-27 12:27:21 PDT
<rdar://problem/34693310>