Closed Bug 1859044 Opened 3 years ago Closed 3 years ago

the message for CLOBBER file should use slash for path separator when printing command

Categories

(Firefox Build System :: General, defect)

defect

Tracking

(firefox120 fixed)

RESOLVED FIXED
120 Branch
Tracking Status
firefox120 --- fixed

People

(Reporter: arai, Assigned: sergesanspaille)

Details

Attachments

(1 external file)

The message around clobber file uses os default path separator when joining the obj directory path and CLOBBER,

https://searchfox.org/mozilla-central/rev/81a006cd60c54ce074d7158fafc5a2923717860e/python/mozbuild/mozbuild/controller/clobber.py#15-18,35-38

CLOBBER_MESSAGE = "".join(
    [
        TextWrapper().fill(line) + "\n"
        for line in """
...
If you know this clobber doesn't apply to you or you're feeling lucky -- \
Well, are ya? -- you can ignore this clobber requirement by running:

 $ touch {clobber_file}

https://searchfox.org/mozilla-central/rev/81a006cd60c54ce074d7158fafc5a2923717860e/python/mozbuild/mozbuild/controller/clobber.py#244-247

return CLOBBER_MESSAGE.format(
    clobber_reason="\n".join(lines),
    no_reason="  " + reason,
    clobber_file=self.obj_clobber,

https://searchfox.org/mozilla-central/rev/81a006cd60c54ce074d7158fafc5a2923717860e/python/mozbuild/mozbuild/controller/clobber.py#57

self.obj_clobber = os.path.join(topobjdir, "CLOBBER")

it results in printing the following on windows, which is not right command because the backslash is treated as escape

 $ touch C:/mozilla-source/mozilla-unified/obj-x86_64-pc-windows-msvc\CLOBBER

the same happens on test's case:

https://searchfox.org/mozilla-central/rev/81a006cd60c54ce074d7158fafc5a2923717860e/python/mozbuild/mozbuild/controller/building.py#55-58,68-71

INSTALL_TESTS_CLOBBER = "".join(
    [
        TextWrapper().fill(line) + "\n"
        for line in """
...
If you did not modify any test files, it is safe to ignore this message \
and proceed with running tests. To do this run:

 $ touch {clobber_file}

https://searchfox.org/mozilla-central/rev/81a006cd60c54ce074d7158fafc5a2923717860e/python/mozbuild/mozbuild/controller/building.py#1656-1657

INSTALL_TESTS_CLOBBER.format(
    clobber_file=os.path.join(self.topobjdir, "CLOBBER")

Do you mean that even on windows, using / as the path separator would be better?

(In reply to [:sergesanspaille] from comment #1)

Do you mean that even on windows, using / as the path separator would be better?

For regular operation, it can be either of them I think, but in the context of "printing the path as a part of command, to let people copy and paste it and run", single backslash doesn't work, because it's not treated as a path separator, but an escape for the next character.

Running touch C:/mozilla-source/mozilla-unified/obj-x86_64-pc-windows-msvc\CLOBBER touches obj-x86_64-pc-windows-msvcCLOBBER file (the escape is ignored for unknown "C" character)
Then, given the self.topobjdir uses slash, it would be easier to use slash also when joining "CLOBBER"

This brings in more consistency and as a side effect should make the
clobber message copy-pastable.

Assignee: nobody → sguelton
Status: NEW → ASSIGNED
Pushed by sguelton@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/6cb5031e7689 Use mozpath instead of os.path for controller path operation r=arai,glandium
Severity: -- → S4
Status: ASSIGNED → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → 120 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: