nwutils/nw-builder

Glob Issue: cp EINVAL src and dest is same

ReiFan49 opened this issue ยท 10 comments

Issue Type

  • Bug Report
  • Feature Request
  • Other

Current/Missing Behaviour

Current behavior "resolves" the path with those 3 arguments, however if one of them is an absolute path, everything breaks.

resolve(
outDir,
platform !== "osx"
? "package.nw"
: "nwjs.app/Contents/Resources/app.nw",
file,
),

image

After some deep inspection, I found out the first item after the globbed file list turned absolute.
image

Expected/Proposed Behaviour

Globbed file list should not have any absolute reference if they don't have in the first place.

Additional Info

  • Package version: 4.2.0
  • Operating System: Linux
  • Node version: v16.20.0
  • NW.js version: 8.19.4
  • Repro link:

@ReiFan49 Thanks for the bug report! I noticed you have a branch which seems to fix this behaviour. Are you opento submitting a PR?

I made that branch for quicker git npm install on Github Action

That branch is just band-aid solution which I may suspect the root of the problem is not on build.js file.

I would be fine if it's referred or cherry picked (for further testing) as I would wait until actual solution/patch to this problem instead.

@ReiFan49 This is a known issue. I got busy with life and let this issue slip through my fingers. I'll try to look at it this week!

Any update on this?

@rocketVibes @ReiFan49 Apologies for the delay, I've been working on it locally - should have a PR up in next 2 days.

@ayushmanchhabra no worries. looking forward to it!

That branch is just band-aid solution which I may suspect the root of the problem is not on build.js file.

@ReiFan49 Turns out you were right!

@rocketVibes Please try v4.2.3-beta.1 and let me know if you run into any other issues.

@ayushmanchhabra the original issue appears to be resolved! However, I would love if you could add verbatimSymlinks: true to the build.js to support symbolic links. This was previously supported and I have tested it locally. i.e.

for (let file of files) {
    log.debug('Copy ${file} file to ${outDir} directory');
    await cp(
      file,
      resolve(
        outDir,
        platform !== "osx" ? "package.nw" : "nwjs.app/Contents/Resources/app.nw",
        file
      ),
      { recursive: true, verbatimSymlinks: true }
    );
}

@rocketVibes what's your use case for verbatimSymlinks? I've personally never needed it.