Skip to content

1.4: fix {NL} double CR on Windows, fix tests failing on MSYS2 / Cygwin - #10638

Merged
ThomasWaldmann merged 1 commit into
borgbackup:1.4-maintfrom
ThomasWaldmann:fix-msys2-new-tests-1.4
Nov 17, 2026
Merged

ThomasWaldmann merged 1 commit into
borgbackup:1.4-maintfrom
ThomasWaldmann:fix-msys2-new-tests-1.4

Conversation

@ThomasWaldmann

@ThomasWaldmann ThomasWaldmann commented Nov 16, 2026 •

Copy link
Copy Markdown
Member

Running the test suite of borg 1.4.6rc1 (from PyPI) on Windows 11 with MSYS2 UCRT64 (Python 3.14) showed some failures that are not in 1.4.5 or that are easy to fix:

{NL} / {NEWLINE} gave "\r\r\n" line ends on Windows - backport of 66a407f from master (by Rayyan Ansari):

{NL} was os.linesep, but borg list writes the formatted output to the sys.stdout text stream, which translates "\n" to os.linesep on Windows once more. This affected custom --format strings and also the default borg list formats (they end with {NL}). Now {NL} is "\n", as on master.

Tests:

  • info --quick-stats: look for the Archive name line via splitlines(), the output has "\r\n" line ends on Windows.
  • test_list_repository_format: compare with os.linesep line ends (exactly, so "\r\r\n" from {NL} gets caught), resp. look for the lines via splitlines().
  • test_repository_previously_remote: skip on Windows, borg 1.4 does not support remote repository locations there.
  • delete_segment_dir: delete the segment files via the repository, so it first closes the fds it has open for them. Windows can not remove a file that is still open (WinError 32).
  • test_create_read_special_symlink: skip on Cygwin like master does, it hangs there (also with 1.4.5): Cygwin's stat() does not follow a symlink to a FIFO (stat -L / test -p neither), so borg archives the symlink and the test's FIFO writer never gets a reader.
  • test_atime_open_updates_atime (new in 1.4.6): do not create a hard link, like test_atime. On Cygwin, creating a hard link to an executable file updates its atime, so extract changed the atime of input/file1 (mode 4755).

Fixed on MSYS2: test_create_ctrl_c_writes_checkpoint, test_create_paths_from_stdin_ctrl_c, test_extract_duplicate_hardlink_item, test_info_quick_stats, test_list_repository_format, test_repository_previously_remote (in-process and binary variants, where they run) and RepositoryCheckTestCase.test_repair_missing_segment_dir.

Not addressed here, because 1.4.5 has the same failures on MSYS2:

  • the remote test variants: the __testsuite__:C:/... test location is invalid on Windows.
  • *_from_command tests: create --paths-from-command / --content-from-command pass preexec_fn to Popen, which is not supported on Windows.

Tested:

  • Windows 11 / MSYS2 UCRT64, full suite with these changes applied to 1.4.6rc1: 11 failures fixed (see above), no new failures.
  • Windows 11 / Cygwin 3.6.12: test_create_read_special_symlink is skipped instead of hanging, test_atime_open_updates_atime passes. The remaining Cygwin failures are the same with 1.4.5 (--stdin-user default uid2user(0) is None on Cygwin, test_umask, test_get_item_uid_gid).
  • macOS: full suite passes.

🤖 Generated with Claude Code

@ThomasWaldmann
ThomasWaldmann force-pushed the fix-msys2-new-tests-1.4 branch from ac6f45a to 0b17a40 Compare November 16, 2026 21:07
@ThomasWaldmann ThomasWaldmann changed the title tests: fix new 1.4.6 tests failing on Windows (MSYS2) 1.4: fix {NL} double CR on Windows, fix tests failing on MSYS2 Nov 16, 2026
@ThomasWaldmann
ThomasWaldmann force-pushed the fix-msys2-new-tests-1.4 branch 2 times, most recently from e1b1688 to fb058b2 Compare November 16, 2026 21:34
@ThomasWaldmann ThomasWaldmann changed the title 1.4: fix {NL} double CR on Windows, fix tests failing on MSYS2 1.4: fix {NL} double CR on Windows, fix tests failing on MSYS2 / Cygwin Nov 16, 2026
@ThomasWaldmann
ThomasWaldmann force-pushed the fix-msys2-new-tests-1.4 branch from fb058b2 to 16f0406 Compare November 16, 2026 21:44
Use \n for the {NL} / {NEWLINE} format specifiers: \n is automatically
converted on write to the platform-dependent os.linesep. Using
os.linesep instead of \n meant that on Windows, the line ending
became "\r\r\n" (borg list --format and the default borg list
formats). Also switch mentions of {LF} to {NL} in the tests.

Backport of 66a407f from master.

Tests:

- info --quick-stats: look for the "Archive name" line via
  splitlines(), the output has "\r\n" line ends on Windows.
- test_list_repository_format: compare with os.linesep line ends
  (exactly, so "\r\r\n" from {NL} gets caught), resp. look for the
  lines via splitlines().
- test_repository_previously_remote: skip on Windows, borg 1.4 does
  not support remote repository locations there.
- delete_segment_dir: delete the segment files via the repository, so
  it first closes the fds it has open for them. Windows can not remove
  a file that is still open.
- test_create_read_special_symlink: skip on Cygwin like master does,
  it hangs there: Cygwin's stat() does not follow a symlink to a FIFO,
  so borg archives the symlink and the test's FIFO writer never gets
  a reader.
- test_atime_open_updates_atime: do not create a hard link (like
  test_atime), on Cygwin, creating a hard link to an executable file
  updates its atime, so extract changed the atime of input/file1.

Co-authored-by: Rayyan Ansari <rayyan@ansari.sh>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ThomasWaldmann
ThomasWaldmann force-pushed the fix-msys2-new-tests-1.4 branch from 16f0406 to 0a3e013 Compare November 17, 2026 03:51
@ThomasWaldmann
ThomasWaldmann merged commit 5907dfa into borgbackup:1.4-maint Nov 17, 2026
15 checks passed
@ThomasWaldmann
ThomasWaldmann deleted the fix-msys2-new-tests-1.4 branch November 17, 2026 04:18
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.

1 participant