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

Program can not find file symlinks #20

Open
tgockel opened this issue Apr 18, 2019 · 1 comment
Open

Program can not find file symlinks #20

tgockel opened this issue Apr 18, 2019 · 1 comment
Labels
bug Something isn't working

Comments

@tgockel
Copy link
Contributor

tgockel commented Apr 18, 2019

If the target file of an $include is a symbolic link, the program fails to find the file.

Steps

Environment

I made a clean environment of Ubuntu 18.04 with Docker for minimal testing (feel free to jump to "Recreation" if this isn't applicable).

docker --rm -it ubuntu:18.04
apt-get update && apt-get install npm
npm install -g yamlinc@0.1.8
mkdir testbed && cd testbed

Recreation

echo '$include: "./link.yaml"' > root.yaml
echo 'tacos: {}' > target.yaml
ln -s target.yaml link.yaml
yamlinc --strict root.yaml

Expected Behavior

I would expect the output to look something like this:

## --------------------
## warning stuff here...
tacos: {}

Actual Behavior

The program exits with code 1 and gives the following message:

   Analize : root.yaml
 > Problem : file not found './link.yaml' on 'root.yaml' at line 1.

Problem

The issue appears to be in helpers.js:91 with the usage of fs.lstatSync(file).isFile(), specifically, I do not think that lstat should be used. I do not think that a tool like yamlinc means to look at the link stats, but cares about the target file. I believe fs.statSync(file).isFile() is correct here.

tgockel added a commit to tgockel/yamlinc that referenced this issue Apr 18, 2019
This fixes issue javanile#20 -- where you get "file not found" errors when the
target of an `$include` is a symlink to a file. Use of `stat` means the
system will follow these symlinks instead of returning information about
the link itself.
@francescobianco francescobianco added the bug Something isn't working label Apr 19, 2019
@francescobianco
Copy link
Member

Hi @tgockel
your patch is online on the new version
https://www.npmjs.com/package/yamlinc/v/0.1.9
Thanks

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

2 participants