Skip to content

Symlink with absolute path is packed incorrectly #366

Closed

Description

@curtisman

Setup

cd ~
mkdir repro
cd repo
echo hello > hello.txt
ln -s ~/repro/hello.txt world.txt
ls -l

Output:

total 4
-rw-r--r-- 1 xxxxxx xxxxxx  5 Apr 25 14:33 hello.txt
lrwxrwxrwx 1 xxxxxx xxxxxx 29 Apr 25 14:34 world.txt -> /home/xxxxxx/repro/hello.txt

Repro

asar p ~/repro ~/app.asar
asar e ~/app.asar ~/e
ls -l ~/e

Output:

total 4
-rw-r--r-- 1 xxxxxx xxxxxx  6 Apr 25 14:48 hello.txt
lrwxrwxrwx 1 xxxxxx xxxxxx 28 Apr 25 14:48 world.txt -> home/xxxxxx/repro/hello.txt

Note that the extract symlink is relative to ~/e and so point to the wrong location /home/xxxxxx/e/home/xxxxxx/repro/hello.txt instead of /home/xxxxxx/repro/hello.txt

Activity

  1. mmaietta commented on Apr 25, 2025

    @mmaietta
    Contributor

    What version is this on? I don't recall making any changes to symlink logic in recent versions, but I'd like to triage when this issue was introduced (or if it was already existing)

  2. curtisman commented on Apr 25, 2025

    @curtisman
    Author

    I believe the bug is here:

    const target = path.join(parentPath, symlink);
    where the symlink target, which could be an absolute path, is joined with the symlink original location's parent path. It should use path.resolve

    Look thru the blame, this commit likely introduced it: a9b4e7b

    I tested out the version before this commit (3.2.8) and this particular repro works:

    Result of asar extract

    total 4
    -rw-r--r-- 1 xxxxxx xxxxxx  6 Apr 25 16:49 hello.txt
    lrwxrwxrwx 1 xxxxxx xxxxxx 29 Apr 25 16:49 world.txt -> hello.txt
    

    And v3.2.9 I can repro the above bug.

  3. added a commit that references this issue on Jul 4, 2026
    0087cfa
  4. electron-npm-package-publisher commented on Jul 21, 2026

    @electron-npm-package-publisher

    🎉 This issue has been resolved in version 4.2.1 🎉

    The release is available on:

    Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions