Skip to content

Create valid symbolic link to output dir #226

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

Merged
merged 7 commits into from
May 29, 2021
Merged

Create valid symbolic link to output dir #226

merged 7 commits into from
May 29, 2021

Conversation

JordanMartinez
Copy link
Contributor

I was getting a 500 error in #225 (comment) because the symbolic link created via ln -s output ../client/public/js/output was broken.

Adding the --relative flag fixes the issue for me. I get the same view Thomas did in #225.

@hdgarrood
Copy link
Collaborator

Huh, interesting. What platform are you on? CLI tools sometimes have different behaviour across platforms, especially if they have been around a long time, so it would probably be good to check that this works in both macOS and Linux.

@JordanMartinez
Copy link
Contributor Author

Here's my system info:

Linux Kernel: 5.8.0-44-generic
OS: Linux Mint 20.1
GNU bash, version 5.0.17(1)-release (x86_64-pc-linux-gnu)
ln (GNU coreutils) 8.30

@hdgarrood
Copy link
Collaborator

Ok, thanks. Generally the tools on macOS systems are more similar to BSD versions, since that’s what mac is based on, and unfortunately it looks like the BSD version of ln doesn’t support long flags or the —relative flag: https://www.freebsd.org/cgi/man.cgi?ln

I think the most portable option might be to use $PWD so that the links don’t have to be relative, something like ln -s output $PWD/../client/public/js/output perhaps?

@JordanMartinez
Copy link
Contributor Author

I found this comment that says -r is a GNU extension and another comment saying MacOS doesn't have the -r option.

Let me try your idea.

@JordanMartinez
Copy link
Contributor Author

Nope. That doesn't work for me. Perhaps it would be easier to just note the two differences?

@hdgarrood
Copy link
Collaborator

What’s the error? I’m sure there’s a way of getting it to work in both systems.

@JordanMartinez
Copy link
Contributor Author

# cwd = `trypurescript/staging`
$ ln -sv output $PWD/../client/public/js/output
'/home/jordan/Programming/Projects/trypurescript/staging/../client/public/js/output' -> 'output'

# cwd = `trypurescript/client/public/js`
$ file output/Data.Foldable/index.js
output/Data.Foldable/index.js: cannot open `output/Data.Foldable/index.js' (Too many levels of symbolic links)

@hdgarrood
Copy link
Collaborator

Right ok, I think what you have there is the client/public/js/output directory is a symbolic link that points to itself. I think the first argument is being interpreted relative to the second one. Maybe try ln -s “$PWD/output” “$PWD/../client/js/output”?

@JordanMartinez
Copy link
Contributor Author

$ ln -s “$PWD/output” “$PWD/../client/js/output”
ln: failed to create symbolic link '“/home/jordan/Programming/Projects/trypurescript/staging/../client/js/output”': No such file or directory

@JordanMartinez
Copy link
Contributor Author

😆 This solution works, but only because it completely removes the relative path in the second argument

cd client/public/js
ln -s ../../../staging/output/ .

@hdgarrood
Copy link
Collaborator

The “no such file or directory” error there is probably due to the fancy quotes, you’ll want to use normal ones

@JordanMartinez
Copy link
Contributor Author

JordanMartinez commented May 29, 2021

You're right. I copy-pasted what you had above and didn't notice it had fancy quotes. Good catch!

@thomashoneyman Can you confirm that this produces a valid symbolic link on your side?

ln -s "$PWD/output" "$PWD/../client/public/js/output"

@thomashoneyman
Copy link
Member

Yep! Works for me. Though I don't need the quotes -- $PWD/output $PWD/../client/public/js/output works just fine as well. Either way is good.

@JordanMartinez
Copy link
Contributor Author

Though I don't need the quotes -- $PWD/output $PWD/../client/public/js/output works just fine as well. Either way is good.

I need the quotes. Otherwise, it doesn't work.

@hdgarrood
Copy link
Collaborator

You'll need the quotes if you have spaces in any of the parent directories, such as if your username has a space in it.

@JordanMartinez JordanMartinez merged commit 8cd250b into purescript:master May 29, 2021
@JordanMartinez JordanMartinez deleted the fixSymLink branch May 29, 2021 19:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants