Page MenuHomePhorge

Fix PhutilLibraryMapBuilder to call the right function in log()
ClosedPublic

Authored by roguelazer on Aug 3 2021, 18:14.

Details

Summary

arc liberate has been broken for a while because the log function attempts to call fwrite (whose third argument is an integer length) instead of fprintf. I think maybe PHP 5 was more lenient about this? Anyway, this bug makes other development somewhat tricky.

The arcanist source in general seems to be split between fwrite(STDERR, $message."\n") and fprintf(STDERR, "%\n", $message); I decided to go with the latter.

This is sort of a test balloon on submitting diffs to Phorge. Please feel free to let me know if there's anything you'd like done differently!

Test Plan

Ran arc liberate to regenerate source maps and didn't get any errors

Diff Detail

Repository
rARC Arcanist
Branch
fix-log
Lint
Lint Passed
Unit
Tests Passed
Build Status
Buildable 34
Build 34: arc lint + arc unit

Event Timeline

The arcanist source in general seems to be split between fwrite(STDERR, $message."\n") and fprintf(STDERR, "%s\n", $message); I decided to go with the latter.

I think the latter format would be preferred as the formatting is more common elsewhere in the code, as opposed to concatenation.

This looks good to me - though it might be worth submitting this upstream on secure-dot.

This revision is now accepted and ready to land.Aug 7 2021, 20:07

FWIW, I can't land this myself since I don't have push access to any repos; I would appreciate it if someone would either land it (or give me such permissions, if that's the preference).

With this change these log messages are being written out, even though the default of $this->quiet is true. I think this is because rebuild-map.php script unconditionally calls setQuiet() with the value it's passed from the command-line, however ArcanistLiberateWorkflow does not specify or pass in a quiet argument.

I think we should update ArcanistLiberateWorkflow to add a --verbose argument, which if not specified then we pass the --quiet argument to the rebuild-map.php script. This inverts the flag that the script is expecting but I think will provide better default behavior (does not log these additional status messages) but still allows them to be seen with a flag.