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

data always set file permission as executable #2068

Open
2 tasks done
blmarket opened this issue May 4, 2024 · 1 comment
Open
2 tasks done

data always set file permission as executable #2068

blmarket opened this issue May 4, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@blmarket
Copy link
Contributor

blmarket commented May 4, 2024

Bug Description

https://github.com/PyO3/maturin/blob/main/src/module_writer.rs#L1342

will use mode from symlink, not the linked source file. it should be read permission again from source file.

Even after this, L1341 looks buggy to me. It tries to read parent of the source, which is usually a directory. Maybe I'm just wrong, but would like to ask devs to review.

Your maturin version (maturin --version)

main branch

Your Python version (python -V)

Python 3.10.0

Your pip version (pip -V)

N/A

What bindings you're using

None

Does cargo build work?

  • Yes, it works

If on windows, have you checked that you aren't accidentally using unix path (those with the forward slash /)?

  • Yes

Steps to Reproduce

  1. data="data" in pyproject.toml
  2. mkdir -p data/data
  3. cd data/data; ln -s ../../README.md

RUST_LOG=DEBUG maturin build shows:

🐍 Found CPython 3.12 at /usr/bin/python3
📡 Using build options profile, features from pyproject.toml
2024-05-04T06:35:48.649561Z DEBUG maturin::compile: Setting PYO3_PYTHON to /usr/bin/python3
2024-05-04T06:35:48.649566Z DEBUG maturin::compile: Running env -u CARGO PYO3_ENVIRONMENT_SIGNATURE="cpython-3.12-64bit" PYO3_PYTHON="/usr/bin/python3" PYTHON_SYS_EXECUTABLE="/usr/bin/python3" "cargo" "rustc" "--profile" "release" "--features" "pyo3/extension-module" "--message-format" "json-render-diagnostics" "--manifest-path" "/home/blmarket/proj/llm-daemon/bihyung/Cargo.toml" "--lib"
    Finished `release` profile [optimized] target(s) in 0.06s
2024-05-04T06:35:48.795601Z DEBUG maturin::module_writer: Adding bihyung-0.2.10.dist-info/METADATA
2024-05-04T06:35:48.795654Z DEBUG maturin::module_writer: Adding bihyung-0.2.10.dist-info/WHEEL
2024-05-04T06:35:48.795688Z DEBUG maturin::module_writer: Adding bihyung/__init__.py
2024-05-04T06:35:48.795719Z DEBUG maturin::module_writer: Adding bihyung/bihyung.cpython-312-x86_64-linux-gnu.so from /home/blmarket/proj/llm-daemon/target/release/maturin/libbihyung.so
2024-05-04T06:35:49.082972Z DEBUG maturin::module_writer: Adding data from /home/blmarket/proj/llm-daemon/bihyung/data/data
2024-05-04T06:35:49.082999Z DEBUG maturin::module_writer: Adding data/data/README.md from ../..
💥 maturin failed
  Caused by: Failed to include data from /home/blmarket/proj/llm-daemon/bihyung/data
  Caused by: Failed to read ../..
  Caused by: failed to read from file `../..`
  Caused by: Is a directory (os error 21)
@blmarket blmarket added the bug Something isn't working label May 4, 2024
@blmarket
Copy link
Contributor Author

blmarket commented May 4, 2024

I can create a PR if it's okay to change L1341 to remove parent() and read permission from source file.

blmarket added a commit to blmarket/maturin that referenced this issue May 4, 2024
Would like to put symlink in a python module, so it will be copied
to wheel package. (I know `data` is there, but it's was not working as
I expected - PyO3#2068)

This commit will use permission from the source file
blmarket added a commit to blmarket/maturin that referenced this issue May 4, 2024
Would like to put symlink in a python module, so it will be copied
to wheel package. (I know `data` is there, but it's was not working as
I expected - PyO3#2068)

This commit will use permission from the source file
blmarket added a commit to blmarket/maturin that referenced this issue May 4, 2024
Would like to put symlink in a python module, so it will be copied
to wheel package. (I know `data` is there, but it's was not working as
I expected - PyO3#2068)

This commit will use permission from the source file
messense pushed a commit that referenced this issue May 13, 2024
Would like to put symlink in a python module, so it will be copied
to wheel package. (I know `data` is there, but it's was not working as
I expected - #2068)

This commit will use permission from the source file
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant