Skip to content
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

upgrade gix to the latest release 0.69. #14975

Merged
merged 1 commit into from
Dec 22, 2024
Merged

Conversation

Byron
Copy link
Member

@Byron Byron commented Dec 22, 2024

The main benefit is that it won't facilitate hangs due to attempts to read from untrackable directory entries, like names pipes or sockets.

Related to GitoxideLabs/gitoxide#1629

Tasks

Postponed

It turns out that the new gix version doesn't magically fix the FIFO issue, so the following test still fails.

It's not super-trivial to fix apparently (I tried), so let's do it in a separate PR.

Here is the patch I have so far in case anyone is interested to fix it earlier or wants to share insights :).

commit dfef545eae215f0b9da9f3d4424b52cba7edaec3
Author: Sebastian Thiel <[email protected]>
Date:   Sun Dec 22 19:05:40 2024 +0100

    fix: assure possibly blocking non-files (like FIFOs) won't be picked up for publishing.
    
    This would otherwise cause the publish to hang.

diff --git a/src/cargo/sources/path.rs b/src/cargo/sources/path.rs
index 776590697..c78463a32 100644
--- a/src/cargo/sources/path.rs
+++ b/src/cargo/sources/path.rs
@@ -626,8 +626,11 @@ fn list_files_gix(
         .filter(|res| {
             // Don't include Cargo.lock if it is untracked. Packaging will
             // generate a new one as needed.
+            // Also don't include untrackable directory entries, like FIFOs.
             res.as_ref().map_or(true, |item| {
-                !(item.entry.status == Status::Untracked && item.entry.rela_path == "Cargo.lock")
+                item.entry.disk_kind != Some(gix::dir::entry::Kind::Untrackable)
+                    && !(item.entry.status == Status::Untracked
+                        && item.entry.rela_path == "Cargo.lock")
             })
         })
         .map(|res| res.map(|item| (item.entry.rela_path, item.entry.disk_kind)))
diff --git a/tests/testsuite/package.rs b/tests/testsuite/package.rs
index 1740de4ac..1c6b3db89 100644
--- a/tests/testsuite/package.rs
+++ b/tests/testsuite/package.rs
@@ -6873,3 +6873,29 @@ See https://doc.rust-lang.org/cargo/reference/manifest.html#package-metadata for
 "#]])
         .run();
 }
+
+#[cargo_test]
+#[cfg(unix)]
+fn simple_with_fifo() {
+    let p = project()
+        .file(
+            "Cargo.toml",
+            r#"
+                [package]
+                name = "foo"
+                version = "0.1.0"
+                edition = "2015"
+            "#,
+        )
+        .file("src/main.rs", "fn main() {}")
+        .build();
+
+    std::process::Command::new("mkfifo")
+        .current_dir(p.root())
+        .arg(p.root().join("blocks-when-read"))
+        .status()
+        .expect("a FIFO can be created");
+
+    // If this hangs, Cargo tried to package a FIFO and is reading it forever.
+    p.cargo("package").run();
+}

@rustbot
Copy link
Collaborator

rustbot commented Dec 22, 2024

r? @ehuss

rustbot has assigned @ehuss.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Dec 22, 2024
The main benefit is that it won't facilitate hangs due to attempts
to read from untrackable directory entries, like names pipes or
sockets.

Related to GitoxideLabs/gitoxide#1629
@rustbot rustbot added the A-git Area: anything dealing with git label Dec 22, 2024
@Byron Byron marked this pull request as ready for review December 22, 2024 18:24
Copy link
Member

@weihanglo weihanglo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting FIFO issue 😆.

Agree we can deal with it separately. Thank you for this update!

@weihanglo weihanglo added this pull request to the merge queue Dec 22, 2024
Merged via the queue into rust-lang:master with commit cfa27f2 Dec 22, 2024
22 checks passed
@Byron Byron deleted the gix-upgrade branch December 23, 2024 06:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-git Area: anything dealing with git S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants