Skip to content

[Bug?]: yarn install does not set executable bit on bin files when folder has been manually removed #5344

@scottbessler

Description

@scottbessler

Self-service

  • I'd be willing to implement a fix

Describe the bug

Yarn, when using the node-modules linker, when adding a missing dependency, does not properly set the executable bit for the files defined in the bin directive.

To reproduce

  1. add a package like protobufjs-cli to your package.json
  2. run yarn install
  3. note the file node_modules/protobufj-cli/pbjs is marked executable
  4. remove the protobufjs-cli from node_modules (i.e. via rm -rf node_modules/protobufjs-cli)
  5. run yarn install
  6. note the file node_modules/protobufj-cli/pbjs is NOT marked executable

Environment

System:
    OS: macOS 13.2.1
    CPU: (10) arm64 Apple M1 Pro
  Binaries:
    Node: 18.15.0 - /private/var/folders/n1/3jwsrn0j1h17qckdb157pdjw0000gn/T/xfs-17b29353/node
    Yarn: 3.5.0 - /private/var/folders/n1/3jwsrn0j1h17qckdb157pdjw0000gn/T/xfs-17b29353/yarn
    npm: 9.5.0 - ~/.volta/tools/image/node/18.15.0/bin/npm

Additional context

➜ cat .yarnrc.yml
nodeLinker: node-modules

yarnPath: .yarn/releases/yarn-3.5.0.cjs

➜ yarn
➤ YN0000: ┌ Resolution step
➤ YN0000: └ Completed
➤ YN0000: ┌ Fetch step
➤ YN0000: └ Completed
➤ YN0000: ┌ Link step
➤ YN0000: └ Completed
➤ YN0000: Done in 0s 93ms

➜ ll node_modules/protobufjs-cli/bin
total 16
-rwxr-xr-x  1 username  staff  203 Mar 24 15:21 pbjs
-rwxr-xr-x  1 username  staff  203 Mar 24 15:21 pbts

➜ rm -rf node_modules/protobufjs-cli 

➜ yarn
➤ YN0000: ┌ Resolution step
➤ YN0000: └ Completed
➤ YN0000: ┌ Fetch step
➤ YN0000: └ Completed
➤ YN0000: ┌ Link step
➤ YN0000: └ Completed
➤ YN0000: Done in 0s 113ms

➜ ll node_modules/protobufjs-cli/bin
total 16
-rw-r--r--  1 username  staff  203 Mar 24 15:22 pbjs
-rw-r--r--  1 username  staff  203 Mar 24 15:22 pbts

➜ yarn --version
3.5.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions