Skip to content

All symlinks have a trailing newline in target #50

Description

@amaanq

Problem

All symlinks in the repository have a trailing newline character (\n / 0x0a) in their target paths. This causes issues with tools that don't expect newlines in symlink targets.

This can be verified by using readlink:

$ readlink "./icons/RoséPine/64x64/mimetypes/video-webm.svg" | xxd
00000000: 7669 6465 6f2d 782d 6765 6e65 7269 632e  video-x-generic.
00000010: 7376 670a                                svg.
                 ^^-- trailing newline (0x0a)

This breaks tooling that doesn't expect whitespace in symlinks (in my case, nix-index....). I assume that this was likely caused by using echo instead of echo -n or printf when creating the symlinks, e.g.:

ln -s "$(echo video-x-generic.svg)" video-webm.svg

instead of..

ln -s "$(printf '%s' video-x-generic.svg)" video-webm.svg

Ideally every symlink should be recreated without the trailing newline. You could run something like the following:

find . -type l | while read -r link; do
    target=$(readlink "$link")
    target_fixed=${target%$'\n'}
    if [[ "$target" != "$target_fixed" ]]; then
        rm "$link"
        ln -s "$target_fixed" "$link"
    fi
done

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions