Skip to content

Bad edge case handling of concatenated dunce::simplified() paths (Windows) #6287

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

Open
m-haug opened this issue Apr 8, 2025 · 7 comments
Open
Labels
🐛bug Something isn't working 🪟Windows

Comments

@m-haug
Copy link

m-haug commented Apr 8, 2025

Description

Since updating to jj v0.28, best as I can tell, jj git init panics with a file not found error.

Steps to Reproduce the Problem

  1. Run jj git init

Expected Behavior

Creating a new repository

Actual Behavior

Panic when writing operations.

Specifications

  • Platform: Windows 11
  • Version: 0.28.2

Output

$ env RUST_BACKTRACE=full jj --debug git init colocate
2025-04-08T08:13:31.758354Z  INFO jj_cli::cli_util: debug logging enabled
2025-04-08T08:13:31.835155Z  INFO run_command:build_index_segments_at_operation{operation=Operation { id: OperationId("00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000") }}: jj_lib::default_index::store: indexing commits reachable from historical heads maybe_parent_file=None heads_count=1
2025-04-08T08:13:31.836470Z  INFO run_command:build_index_segments_at_operation{operation=Operation { id: OperationId("00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000") }}: jj_lib::default_index::store: saved new index file index_file=ReadonlyIndexSegment { name: "d27ad326963b75736b636adad9fb812eb3f2871e0efb4bc7db37d4b701a4282911eaaee91bed3a759e940769b667be1ed66f2d7f2f41ac3906b87ab7eec19c3a", parent_file: None } commits_count=1

thread 'main' panicked at lib\src\transaction.rs:138:14:
called `Result::unwrap()` on an `Err` value: WriteObject { object_type: "operation", source: Os { code: 3, kind: NotFound, message: "Das System kann den angegebenen Pfad nicht finden." } }
stack backtrace:
   0:     0x7ff6912dec31 - git_odb_object_data
   1:     0x7ff691305eea - git_odb_object_data
   2:     0x7ff6912d8797 - git_odb_object_data
   3:     0x7ff6912dea75 - git_odb_object_data
   4:     0x7ff6912e17c0 - git_odb_object_data
   5:     0x7ff6912e15b1 - git_odb_object_data
   6:     0x7ff6912e239f - git_odb_object_data
   7:     0x7ff6912e2139 - git_odb_object_data
   8:     0x7ff6912df79f - git_odb_object_data
   9:     0x7ff6912e1d3e - git_odb_object_data
  10:     0x7ff6914633a1 - git_midx_writer_new
  11:     0x7ff6914637d0 - git_midx_writer_new
  12:     0x7ff690e23a6c - git_filter_source_repo
  13:     0x7ff690e36936 - git_filter_source_repo
  14:     0x7ff690e38ef2 - git_filter_source_repo
  15:     0x7ff690e39c6c - git_filter_source_repo
  16:     0x7ff690e37d6b - git_filter_source_repo
  17:     0x7ff6906bd472 - git_filter_source_repo
  18:     0x7ff690906304 - git_filter_source_repo
  19:     0x7ff6904911e3 - <unknown>
  20:     0x7ff69060b65b - <unknown>
  21:     0x7ff69081ca44 - git_filter_source_repo
  22:     0x7ff69040105e - <unknown>
  23:     0x7ff690401016 - <unknown>
  24:     0x7ff6912cde0c - git_odb_object_data
  25:     0x7ff69040109c - <unknown>
  26:     0x7ff691427494 - git_midx_writer_new
  27:     0x7ffe2c53e8d7 - BaseThreadInitThunk
  28:     0x7ffe2d6314fc - RtlUserThreadStart
@m-haug
Copy link
Author

m-haug commented Apr 8, 2025

The problem seems isolated to jj git init, working with an existing repository didn't cause any problems.

@yuja
Copy link
Contributor

yuja commented Apr 8, 2025

Panicking is bad, but I have no idea why NotFound error occurred in the write path. Which one is the last working jj version? Some changes in the tempfile crate might cause a problem, but an index file appears to be written successfully.

Maybe there would be some Windows tool to trace system call?

@m-haug
Copy link
Author

m-haug commented Apr 8, 2025

Panicking is bad, but I have no idea why NotFound error occurred in the write path.

AFAIK, that can happen when trying to write to a directory that doesn't exist.

Which one is the last working jj version?

I just went back through old scoop versions, and the problem was absent from v0.24.0, but occurs in v0.25.0.

@m-haug
Copy link
Author

m-haug commented Apr 8, 2025

But now, v0.28.2 fails with the repository initialized by v0.24 as well.

v0.25 failing is weird because I definitely updated jj since the start of the year, so I should have had v0.25 at least.

@yuja
Copy link
Contributor

yuja commented Apr 8, 2025

AFAIK, that can happen when trying to write to a directory that doesn't exist.

Sure. I mean I have no idea why the directory didn't exist, etc.

I just went back through old scoop versions, and the problem was absent from v0.24.0, but occurs in v0.25.0.

One potential change that could affect Windows is 78b5766. If your work directory path is long, can you test with shorter path (or longer path enough to enforce the \\?\C:\ prefix)? I suspect the repository path is okay without \\?\, but the concatenated file path isn't.

@m-haug
Copy link
Author

m-haug commented Apr 8, 2025

If your work directory path is long, can you test with shorter path (or longer path enough to enforce the \?\C:\ prefix)?

I renamed the directory to have a shorter path, and, indeed, the error went away.

@yuja yuja changed the title jj git init fails Bad edge case handling of concatenated dunce::simplified() paths (Windows) Apr 8, 2025
@yuja yuja added 🐛bug Something isn't working 🪟Windows labels Apr 8, 2025
@yuja
Copy link
Contributor

yuja commented Apr 8, 2025

Things like https://crates.io/crates/cap-std might help if it uses openat()-like API on Windows. We could instead keep user-facing path and canonicalized path separately, but that would be horrible.

iirc, there's a some way to extend the maximum path length by setting metadata to executable, but I don't know the detail.

yuja added a commit to yuja/jj that referenced this issue Apr 9, 2025
yuja added a commit to yuja/jj that referenced this issue Apr 9, 2025
This will probably help debug weird problem like jj-vcs#6287. File names are a bit
redundant for ReadObject errors (which include ObjectId), but that should be
okay.
yuja added a commit to yuja/jj that referenced this issue Apr 10, 2025
yuja added a commit to yuja/jj that referenced this issue Apr 10, 2025
This will probably help debug weird problem like jj-vcs#6287. File names are a bit
redundant for ReadObject errors (which include ObjectId), but that should be
okay.
github-merge-queue bot pushed a commit that referenced this issue Apr 12, 2025
This will probably help debug weird problem like #6287. File names are a bit
redundant for ReadObject errors (which include ObjectId), but that should be
okay.
kejadlen pushed a commit to kejadlen/jj that referenced this issue Apr 16, 2025
kejadlen pushed a commit to kejadlen/jj that referenced this issue Apr 16, 2025
This will probably help debug weird problem like jj-vcs#6287. File names are a bit
redundant for ReadObject errors (which include ObjectId), but that should be
okay.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛bug Something isn't working 🪟Windows
Projects
None yet
Development

No branches or pull requests

2 participants