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
aur-fetch: unset GIT_DIR and GIT_WORK_TREE #636
Conversation
|
This should be fixed along the way in 4dbab52 Anyway, a test case, nice. 👍 |
test/issue-636
Outdated
| export AURDEST | ||
|
|
||
| cleanup() { | ||
| rm -rf --one-file-system --preserve-root "${AURDEST?}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A question since "cleanup" is used in other places with temporary files: why those extra flags to rm, if the target string is quoted?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Two things: an abundance of caution and (marginally) better diagnostics (well, three, including force of habit). Certainly not wedded to this approach, though, so I've harmonized this trap function with others in the existing codebase.
test/issue-636
Outdated
| @@ -0,0 +1,14 @@ | |||
| #!/bin/bash | |||
|
|
|||
| AURDEST="$(mktemp -d --tmpdir "aurutils-${BASH_SOURCE[0]##*/}.XXXXXXXX")" | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it suffices to set argv0=issue-636, aurutils-$argv0 as other aur scripts
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
|
Should be fixed in master, but I'd still be interested in merging the regression test! |
Indeed! I have rebased the branch on
I've updated the PR in (what I hope is) accordance with your comments; LMKWYT. |
|
Thanks for the update. Just a small nitpick: since |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I seem to have missed this in my previous review.
The PR is not based on current master. Would be nice if you did that along with the suggestions from @AladW
to ensure that GIT_DIR/GIT_WORK_TREE environment variables are properly set on each iteration of the aur-fetch main loop
Ah, yes -- suspect that was an artifact of an earlier test implementation that used |
Just pushed a rebase on |
|
It looks good to me. If we wanted to test more features, I'd say this belongs to other separate tests. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
|
@tomeon tests for new features would be nice, but we need to address some aspects regarding tests in general. I.e. Implement proper infrastructure for testing to avoid issues like #645. Regardless of the approach chosen, we also need some sort of library with functions for common tasks, e.g. setting up repos, configs, etc. Making tests easier to write and run will, hopefully, help turning the #497 list into actual tests. Speaking for myself here, but I rarely run the ones we have. Proper infrastructure, and perhaps automation (hello github actions), would help making sure we actually run the tests. Otherwise it becomes hard to justify the effort that needs to be put in. |
|
@rafasc -- sounds like a bigger discussion, and out-of-scope for this issue, but: what about BATS? Seems to tick some of the boxes you listed: Plus there's an available Docker image for use with (say) Travis CI, and an AUR package that could be used with (e.g.) builds.sr.ht. Food for thought, perhaps :) |
This passes the test in issue aurutils#636
This passes the test in issue aurutils#636
This passes the test in issue aurutils#636
Using
masterat 1b4782e,aur-fetchexits with nonzero status under the following conditions:git clone):The issue appears to be that
aur-fetchdoesn't unsetGIT_DIRorGIT_WORK_TREEat the beginning of the "main" loop, thus reusing the values ofGIT_DIRandGIT_WORK_TREEset on the prior iteration.This merge request adds
unset GIT_DIR GIT_WORK_TREEto the beginning of the main loop inaur-fetch, as well as a regression test case.TIA for your consideration :)