Skip to content

safe-rm: fix test for Linux #113151

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

Closed
wants to merge 1 commit into from

Conversation

n-thumann
Copy link
Contributor

@n-thumann n-thumann commented Oct 14, 2022

  • Have you followed the guidelines for contributing?
  • Have you ensured that your commits follow the commit style guide?
  • Have you checked that there aren't other open pull requests for the same formula update/change?
  • Have you built your formula locally with brew install --build-from-source <formula>, where <formula> is the name of the formula you're submitting?
  • Is your test running fine brew test <formula>, where <formula> is the name of the formula you're submitting?
  • Does your build pass brew audit --strict <formula> (after doing brew install --build-from-source <formula>)? If this is a new formula, does it pass brew audit --new <formula>?

This PR fixes the test of safe-rm for Linux.
Part of #86422.

Currently, the test fails on Linux (e.g. Debian Bullseye), but runs perfectly fine on macOS:

root@908e57a9f29d:/tmp# brew test safe-rm
==> Testing safe-rm
==> /home/linuxbrew/.linuxbrew/Cellar/safe-rm/1.1.0/bin/safe-rm /tmp/safe-rm-test-20221014-25143-k2k4f5/foo
==> /home/linuxbrew/.linuxbrew/Cellar/safe-rm/1.1.0/bin/safe-rm /tmp/safe-rm-test-20221014-25143-k2k4f5/bar 2>&1
Error: safe-rm: failed
An exception occurred within a child process:
  Minitest::Assertion: Expected: 64
  Actual: 1
[...snip...]

As it turns out, rm (whose return code is simply passed via safe-rm), returns 1 on Linux and 64 on BSD when misusing it. This is expected behavior of safe-rm.

➜  homebrew-core git:(master) uname -rs && rm || echo $?
Darwin 21.6.0
usage: rm [-f | -i] [-dIPRrvWx] file ...
       unlink [--] file
64
root@908e57a9f29d:/tmp# uname -rs && rm || echo $?
Linux 5.10.124-linuxkit
rm: missing operand
Try 'rm --help' for more information.
1

@BrewTestBot BrewTestBot added no Linux bottle Formula has no Linux bottle rust Rust use is a significant feature of the PR or issue labels Oct 14, 2022
@BrewTestBot
Copy link
Member

🤖 A scheduled task has triggered a merge.

@n-thumann
Copy link
Contributor Author

@dawidd6 would you mind adding the hacktoberfest-accepted label to this? Because the PRs get closed by the bot, they won't be taken into account.

@github-actions github-actions bot added the outdated PR was locked due to age label Nov 15, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 15, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
hacktoberfest-accepted no Linux bottle Formula has no Linux bottle outdated PR was locked due to age rust Rust use is a significant feature of the PR or issue
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants