Bug 248675 - commit-log-editor doesn't handle a core.editor path with spaces well, complains about an invalid path
Summary: commit-log-editor doesn't handle a core.editor path with spaces well, complai...
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: Tools / Tests (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2022-12-02 12:42 PST by Eryn Wells
Modified: 2022-12-09 12:43 PST (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Eryn Wells 2022-12-02 12:42:42 PST
When trying to post a patch for review, I see this error:

```
Amending commit f003c023cdbb3a715efefdd769179ac642a5a80e
hint: Waiting for your editor to close the file... Can't exec "/Applications/Sublime\": No such file or directory at ../OpenSource/Tools/Scripts/commit-log-editor line 180.
  Running status to find changed, added, or removed files.
  No changes found.
Can't exec "/Applications/Sublime\": No such file or directory at ../OpenSource/Tools/Scripts/commit-log-editor line 227.
Aborting commit due to empty commit message.
```

I took a look at commit-log-editor and found that it's trying to exec the editor command on line 180 like this:

```
exec (@editor, @ARGV) if $existingLog && $keepExistingLog;
```

@editor is being set starting on line 93 by first consulting Git's global core.editor setting:

```
git config --global --get core.editor
```

That setting is set to:

```
$ git config --global --get core.editor
/Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl --new-window --wait
```

Further down, on line 131, the output of that git command is split by spaces. I think this is the source of the bug.
Comment 1 Alexey Proskuryakov 2022-12-02 12:46:26 PST
Clearly, this is fixable if we start to honor backslashes.

However, another approach is to honor Sublime's own documentation, which says that the user needs to make sure that subl is in the PATH:

--------------------------------------------
v3:

To use subl, the Sublime Text bin folder needs to be added to the path. For a typical installation of Sublime Text, this will be located at /Applications/Sublime Text.app/Contents/SharedSupport/bin.

v2:

The first task is to make a symlink to subl. Assuming you've placed Sublime Text 2 in the Applications folder, and that you have a ~/bin directory in your path, you can run:

ln -s "/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl" ~/bin/subl
--------------------------------------------

With this, the fix is for git-webkit setup to simply not set core.editor to the full path.
Comment 2 Radar WebKit Bug Importer 2022-12-09 12:43:22 PST
<rdar://problem/103190955>