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

"Configuration error..." when using on files opened from symbolic link directories #18

Open
Gilwyad opened this issue Aug 17, 2013 · 3 comments

Comments

@Gilwyad
Copy link

Gilwyad commented Aug 17, 2013

Consider the following scenario:

~/projects/name/test.pl
~/shortcut -> ~/projects/name

If I open test.pl from projects/name, flymake works. However if I open it through the symbolic link "shortcut" then I get a "configuration error has occured... flymake will be switched off". Analyzing the log file, the problem is the temporary copy test_flymake.pl was not found! It was created correctly however:

[2013-08-17 11:33:07.549462] starting process on dir /home/peter/shortcut/
[2013-08-17 11:33:07.558302] started process 20470, command=(perl -wc ../projects/name/test_flymake.pl)
[2013-08-17 11:33:07.584354] received 85 byte(s) of output from process 20470
[2013-08-17 11:33:07.592350] received process output: 
  > Can't open perl script "../projects/name/test_flymake.pl": No such file or directory
  > 

At first look it seems the path is correct, but there is a problem. On Debian linux in bash, if I'm in a symbolic link that's pointing to a directory, cd .. takes me out of the "symbolic directory" (to where the symbolic link is), but executing a file with .. does not behave the same: it refers to the directory one level above the linked directory, NOT the symbolic link itself!

peter@atom:~$ ls -l
total 12
-rw-r--r-- 1 peter peter 4758 Aug 17 11:35 flymake.log
drwxr-xr-x 3 peter peter 4096 Aug 17 11:25 projects
lrwxrwxrwx 1 peter peter   25 Aug 17 11:27 shortcut -> /home/peter/projects/name

peter@atom:~/shortcut$ cd ..
peter@atom:~$ 
peter@atom:~$ cd shortcut
peter@atom:~/shortcut$ ls ..
name

I would have too, expected ls .. to list the home directory, but it lists ~/projects instead, that's why the file is not found!

@ramnes
Copy link

ramnes commented Jun 19, 2014

I have the exact same problem, and it's really annoying. Anything new on this one?

@ramnes
Copy link

ramnes commented Jun 19, 2014

After investigation, it seems that the problem came from my flymake + pyflakes init snippet. See ramnes/.emacs.d@d47e200.

@domq
Copy link

domq commented Jul 9, 2018

Right, but still, there is a lot of Emacs code out there (including inside flymake.el) that still calls
file-relative-name in a way that exhibits this issue. Here is a workaround:

(defun with-noop-file-relative-name
    (orig &rest init-args)
  "Ensures that `file-relative-name' does nothing while calling ORIG."
  (cl-letf (((symbol-function 'file-relative-name)
             (lambda (orig-name &rest ignores) orig-name)))
    (apply orig init-args)))

And then, advise every function such as php-flymake-php-init that relies internally on file-relative-name:

(eval-after-load "php-mode"
    '(add-function :around (symbol-function 'php-flymake-php-init)
                   #'with-noop-file-relative-name))

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

No branches or pull requests

3 participants