Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable pipefail for proper error propagation #219

Merged
merged 1 commit into from
Jul 11, 2022
Merged

Enable pipefail for proper error propagation #219

merged 1 commit into from
Jul 11, 2022

Conversation

apjanke
Copy link
Contributor

@apjanke apjanke commented Apr 11, 2019

Fixes #216.

This sets the bash pipefail option, which causes the exit status of the pipeline to be the latest non-success status, instead of just the last element's status. This way, failures in the tar command will abort the build with a failure status.

@catch22
Copy link
Collaborator

catch22 commented Apr 11, 2019

This look good. However, it reveals another problem, namely that even when the tar call fails (imagine macOS without gtar installed) it will create an empty tar file, so another invocation of make thinks that this target has been built successfully:

$ make dist
mkdir -p "tmp"
Creating package version 0.7.0 release ...
rm -f -r "tmp/doctest-0.7.0"
git archive --format=tar --prefix="tmp/doctest-0.7.0/" HEAD | tar  -x
rm -f "tmp/doctest-0.7.0/README.matlab.md" \
	      "tmp/doctest-0.7.0/.gitignore" \
	      "tmp/doctest-0.7.0/.travis.yml" \
	      "tmp/doctest-0.7.0/.mailmap"
rm -f -r "tmp/doctest-0.7.0/util"
chmod -R a+rX,u+w,go-w "tmp/doctest-0.7.0"
tar: Option --mtime=2019-04-11 04:13:25 -0400 is not supported
Usage:
  List:    tar -tf <archive-filename>
  Extract: tar -xf <archive-filename>
  Create:  tar -cf <archive-filename> [filenames...]
  Help:    tar --help

$ make dist
make: Nothing to be done for `dist'.

Should we delete the tar file when the pipe fails?

@apjanke
Copy link
Contributor Author

apjanke commented Apr 19, 2019

Should we delete the tar file when the pipe fails?

Yeah, but I'm not sure how to do that here.

@cbm755
Copy link
Collaborator

cbm755 commented Jul 11, 2022

None-the-less, this is a step forward, merging..., then I'll reopen the issue and link here.

@cbm755 cbm755 merged commit 147957d into gnu-octave:master Jul 11, 2022
@apjanke apjanke deleted the fix-tar-error-propagation branch February 11, 2024 17:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

'make dist' creates empty tarball on macOS
3 participants