Bug 165440 - ChangeLogs become readonly after resolving a conflict
Summary: ChangeLogs become readonly after resolving a conflict
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Tools / Tests (show other bugs)
Version: Other
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Alexey Proskuryakov
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2016-12-05 17:05 PST by Alexey Proskuryakov
Modified: 2016-12-12 10:18 PST (History)
4 users (show)

See Also:


Attachments
naive fix (1.10 KB, patch)
2016-12-05 17:10 PST, Alexey Proskuryakov
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Alexey Proskuryakov 2016-12-05 17:05:08 PST
When update-webkit or resolve-ChangeLogs resolves a conflict in a ChangeLog, the file becomes read-only.

This looks like a change between svn 1.5 and svn 1.7 - "older" and "newer" files that are created on conflict are read-only, and one of these becomes the resolved file.

<rdar://problem/29491002>
Comment 1 Alexey Proskuryakov 2016-12-05 17:10:34 PST
Created attachment 296224 [details]
naive fix

It seems good enough to just use 0644 - I don't think that we need to preserve other bits here.

I'm somewhat confused about how merging works on a read-only file up to this point, but it does. Perhaps the patch tool doesn't care about permissions when they can be automagically adjusted while patching?
Comment 2 David Kilzer (:ddkilzer) 2016-12-05 20:15:43 PST
Comment on attachment 296224 [details]
naive fix

View in context: https://bugs.webkit.org/attachment.cgi?id=296224&action=review

> Tools/Scripts/resolve-ChangeLogs:451
> +            chmod 0644, $fileNewer;

This won't work well when applying a patch to a script that has execute (+x) permissions.

Does Perl have a way to say, "chmod a+w" instead?

Or does svn has a command-line switch to restore its previous behavior?
Comment 3 Alexey Proskuryakov 2016-12-05 20:53:09 PST
As this is resolve-ChangeLogs scripts, I assume that it won't be used to resolve conflicts in scripts. I didn't find such a switch for svn (nor any discussion of why the change was made).
Comment 4 Darin Adler 2016-12-11 18:40:50 PST
Comment on attachment 296224 [details]
naive fix

View in context: https://bugs.webkit.org/attachment.cgi?id=296224&action=review

I guess this is OK. I have suggestions though.

>> Tools/Scripts/resolve-ChangeLogs:451
>> +            chmod 0644, $fileNewer;
> 
> This won't work well when applying a patch to a script that has execute (+x) permissions.
> 
> Does Perl have a way to say, "chmod a+w" instead?
> 
> Or does svn has a command-line switch to restore its previous behavior?

I looked on the web a bit and I think this is a better version:

    chmod ((stat($file))[2] & 0777), $fileNewer;

It tries to transfer the permissions the old file had, not including exotic permissions like setuid.

Another way to do it is to simple read $fileNewer and overwrite the contents of $file and then unlink $fileNewer instead of $file. That code would not be hard to write.
Comment 5 WebKit Commit Bot 2016-12-12 10:18:35 PST
Comment on attachment 296224 [details]
naive fix

Clearing flags on attachment: 296224

Committed r209714: <http://trac.webkit.org/changeset/209714>
Comment 6 WebKit Commit Bot 2016-12-12 10:18:39 PST
All reviewed patches have been landed.  Closing bug.