Skip to content

Commit

Permalink
Fix chmod in make_rev_spec_parse_repos; regenerate archive on macOS
Browse files Browse the repository at this point in the history
In the preceding two commits, the make_rev_spec_parse_repos fixture
was modified to avoid giving extra executable permissions to a
loose object file where they are not needed, and the affected
fixture archive was regenerated. Though the permissions change is
itself good and causes no problems, the overall change caused two
problems, which are corrected here:

1. I had taken the opportunity to follow better practices when
   running commands in a shell script whose arguments are formed by
   parameter expansion: adding quoting where splitting and globbing
   is not intended but could in principle also be indicated; and
   preceding the argument formed this way with a `--` to designate
   it clearly as a non-option argument, since `chmod` follows the
   XBD Utility Syntax Guidelines, which include `--` recognition.

   While adding quoting was a good change (in this case, just for
   clarity that no expansions are intended), the way I added `--`
   created a new problem where none had existed. This is because I
   wrongly thought of it as separating non-filename arguments from
   filename arguments, which is incorrect: in `chmod`, a mode
   argument is neither an option or an operand to an option.
   Accordingly, only some implementations of `chmod` allow it to be
   placed after the mode.

   This commit corrects that by placing it before the mode argument
   instead, which is portable while still achieving the goal of
   establishing the argument after it as as never being meant to be
   interpreted as an option (regardless of whether the system's
   `chmod` recognizes options after non-option arguments).

2. Due to #1622, regenerating `make_rev_spec_parse_repos.tar` with
   Git 2.47.0 causes

       revision::spec::from_bytes::regex::find_youngest_matching_commit::regex_matches

   to to fail on all systems with all versions of Git, whenever
   `GIX_TEST_IGNORE_ARCHIVES` is *not* set. This differs from the
   usual situation where it fails only when that *is* set and only
   when the available Git is >= 2.47.0. This causes the test to
   fail in the `test-fast` CI job, since the mitigation in #1635
   for when the tests are detected to be running on CI deliberately
   covers only the `GIX_TEST_IGNORE_ARCHIVES` case.

   In the previous commit, I had regenerated that archive on an
   Ubuntu 24.04 LTS system with Git 2.47.0 installed from the
   git-core PPA, causing this problem.

   This commit regenerates the archive again on a macOS 15.0.1
   system with Git 2.39.5 (Apple Git-154), using the command:

       TZ=UTC cargo nextest run --all --no-fail-fast

   All tests passed and the archive was successfully remade. I used
   `TZ=UTC` since I usually regenerate archives on a system whose
   time zone is configured to be UTC rather than local time, and
   more specifically because there is an unrelated bug (to be
   separately reported) causing an unrelated test to fail in some
   time zones in the two weeks that follow daylight saving time
   adjustments.
  • Loading branch information
EliahKagan committed Nov 4, 2024
1 parent 72cd7f3 commit d74e919
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 1 deletion.
Binary file not shown.
2 changes: 1 addition & 1 deletion gix/tests/fixtures/make_rev_spec_parse_repos.sh
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ git init --bare blob.corrupt
echo bnkxmdwz | git hash-object -w --stdin
oid=$(echo bmwsjxzi | git hash-object -w --stdin)
oidf=objects/$(oid_to_path "$oid")
chmod 644 -- "$oidf"
chmod -- 644 "$oidf"
echo broken >"$oidf"

baseline "cafea"
Expand Down

0 comments on commit d74e919

Please sign in to comment.