Skip to content

wolfSSL GitHooks spawn .git/hooks/pre-push: incompatible on Visual Studio Windows WSL #6779

@gojimmypi

Description

@gojimmypi

Version

latest master

Description

Error message: Failed to push to the remote repository. See the Output window for more details.

This has been an easily-resolved, but repeating annoyance for quite some time. I'll submit a PR with a proposed fix.

In all fairness, it is probably more of a Visual Studio and/or WSL and/or Windows problem.

The error occurs in Visual Studio when pushing updates to a fork of wolfssl. This error is encountered:

image

The output window contents from Show output from: Source control - git:

Pushing ED25519_SHA2_fix
Error: cannot spawn .git/hooks/pre-push: No such file or directory
Error: waitpid for (NULL) failed: No child processes
Error: failed to push some refs to 'https://github.com/gojimmypi/wolfssl.git'
Error encountered while pushing to the remote repository: PushCommand.ExecutePushCommand
Failed to push to the remote repository. See the Output window for more details.

Although not very intuitive, the root cause is failure of Visual Studio to properly process a zero-length pre-commit and pre-push files in .git\hooks directory:

image

The problem is easily resolved by simply deleting the files.

I'm fairly certain at this point the problem is caused by autogen.sh when running on WSL using a shared filesystem with Windows, specifically the symbolic links:

ln -s ../../pre-commit.sh .git/hooks/pre-commit
ln -s ../../pre-push.sh .git/hooks/pre-push

Now, there's probably also a question if the pre-commit and pre-push files should have a Windows & Visual Studio compatible version, or if the symbolic link should simply not occur when detecting WSL shared file system.

  • edit: I have a change in place to detect WSL and properly process the files, however Windows of course does not like the pre-commit.sh and pre-push.sh files. So the PR will contain just a TODO for WSL on a Windows File system to perhaps created a DOS batch file at some point in the future. Otherwise Visual Studio fails to commit with an error like this:

image

As a side note: all git commit operations fail on Linux platforms upon fresh git clone if ./configure has never been run, due to the operations of the above-mentioned hooks. In particular this message from ./commit-tests.sh.

Saving current config
Stashing modified files not part of commit
Running commit tests...
Testing current config...
Makefile:717: *** missing separator.  Stop.
Makefile:717: *** missing separator.  Stop.
Current config make test failed
Popping stashed modified files not part of commit
Restoring current config
Oops, your commit failed

See also:

microsoft/WSL#4868
microsoft/WSL#2144
microsoft/WSL#353

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions