Closed Bug 1898339 Opened 2 years ago Closed 22 days ago

`moz-phab` incorrectly uploads symlinks as text files when using Mercurial

Categories

(Conduit :: moz-phab, defect, P3)

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: sheehan, Assigned: sheehan)

References

Details

Attachments

(1 file)

moz-phab version (from moz-phab --version): 1.5.1
Python version (from python3 --version): 3.12.3
OS: Linux

While testing bug 1895762 (which adds a symlink-reject check to Lando) on Lando-dev, I noticed my patch uploaded to Phabricator with moz-phab which includes a symlink didn't trigger the symlink reject check. When I went to https://phabricator-dev.allizom.org/conduit/method/differential.getrawdiff/ and used 5760 as the diffID, I can see the patch contents look like this:

diff --git a/blahfile_symlink b/blahfile_symlink
new file mode 100644
--- /dev/null
+++ b/blahfile_symlink
@@ -0,0 +1 @@
+/home/sheehan/blahfile
\ No newline at end of file

You can see the file mode is 100644, like a regular file on disk with the content of the file as the path the symlink points to. On my local machine the diff looks like:

diff --git a/blahfile_symlink b/blahfile_symlink
new file mode 120000
--- /dev/null
+++ b/blahfile_symlink
@@ -0,0 +1,1 @@
+/home/sheehan/blahfile
\ No newline at end of file

Where the file mode is 120000, representing a symlink.

This looks to be happening as a result of this logic, and appears to be Mercurial-specific. I have yet to determine if Git would have the same problem, and it's likely this is a difference in behaviour between the two systems.

Assignee: nobody → sheehan
Priority: -- → P3

hg files -T {flags} reports l for a symlink, which fell through to the
regular-file mode and made Phabricator treat the symlink as a text file.

Summary: `moz-phab` incorrectly uploads symlinks as text files → `moz-phab` incorrectly uploads symlinks as text files when using Mercurial

Authored by https://github.com/cgsheeh
https://github.com/mozilla-conduit/review/commit/4886f8413d7af4826ab858ba25f451bad36471d3
[main] mercurial: submit symlinks with the 120000 file mode (Bug 1898339) r=shtrom

Status: NEW → RESOLVED
Closed: 22 days ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: