Subject: bug#15780: 24.3; flymake may fail on symlinked files

From: Slaven Rezic <[email-masked]>
Date: Fri, 01 Nov 2013 09:55:30 +0100

flymake fails for the following setup.

First, create a file/directory/symlink setup:

    mkdir -p /tmp/flymaketest/mnt/home
    cd /tmp/flymaketest
    ln -s mnt/home
    touch mnt/home/test.pl

Now start emacs:

    emacs -q

Load the test file using the _symlinked_ path:

    C-x C-f /tmp/flymaketest/home/test.pl

Start flymake:

    M-x flymake-mode

An error dialog shows up:

    Flymake: Configuration error has occurred while running (perl -wc ../mnt/home/test_flymake.pl). Flymake will be switched OFF

Loading the file with the non-symlinked path
/tmp/flymaketest/mnt/home/test.pl and turning on flymake works.

I think the problem is that flymake-create-temp-inplace is using
file-truename now, but for creating the relative file name in, say,
flymake-perl-init file-truename is not used. My current workaround is to
patch flymake-perl-init like this:

      (defun flymake-perl-init ()
	(let* ((temp-file   (flymake-init-create-temp-buffer-copy
			     'flymake-create-temp-inplace))
	       (local-file  (file-relative-name
			     temp-file
			     (file-truename (file-name-directory buffer-file-name)))))
	  (list "perl" (list "-wc " local-file))))

A real solution would need also changes for the other flymake-*-init
functions.

Regards,
    Slaven

In GNU Emacs 24.3.1 (amd64-portbld-freebsd9.1, GTK+ Version 2.24.19)
 of 2013-08-12 on 9-89993
Windowing system distributor `The X.Org Foundation', version 11.0.10707000
Configured using:
 `configure '--localstatedir=/var' '--with-x-toolkit=gtk2' '--with-xft'
 '--with-m17n-flt' '--with-otf' '--with-imagemagick' '--with-gsettings'
 '--with-gconf' '--with-xim' '--with-sound' '--with-dbus' '--with-xml2'
 '--with-gnutls' '--x-libraries=/usr/local/lib'
 '--x-includes=/usr/local/include' '--prefix=/usr/local'
 '--mandir=/usr/local/man' '--infodir=/usr/local/info/'
 '--build=amd64-portbld-freebsd9.1'
 'build_alias=amd64-portbld-freebsd9.1' 'CC=cc' 'CFLAGS=-O2 -pipe
 -fno-strict-aliasing' 'LDFLAGS= -L/usr/local/lib
 -Wl,-rpath=/usr/lib:/usr/local/lib' 'CPPFLAGS=-I/usr/local/include'
 'CPP=cpp''

Important settings:
  value of $LC_ALL: de_DE.ISO8859-1
  value of $LC_TIME: C
  locale-coding-system: iso-latin-1-unix
  default enable-multibyte-characters: t

Major mode: Emacs-Lisp

Minor modes in effect:
  diff-auto-refine-mode: t
  desktop-save-mode: t
  display-time-mode: t
  shell-dirtrack-mode: t
  show-paren-mode: t
  iswitchb-mode: t
  tooltip-mode: t
  mouse-wheel-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  buffer-read-only: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent input:
M-x r e p o r t - e m a <tab> <return>

Recent messages:
Mark set
Auto-saving...done
Auto-saving...done
Saving file /home/e/eserte/doc/misc/ChangeLog...
Wrote /home/e/eserte/doc/misc/ChangeLog
Auto-saving...done
Saving file /home/e/eserte/doc/misc/ChangeLog...
Wrote /home/e/eserte/doc/misc/ChangeLog
(No changes need to be saved)
Mark saved where search started

Load-path shadows:
/home/e/eserte/emacs/arc-mode hides /usr/local/share/emacs/24.3/lisp/arc-mode
/home/e/eserte/emacs/loaddefs hides /usr/local/share/emacs/24.3/lisp/loaddefs
/home/e/eserte/emacs/iso-acc hides /usr/local/share/emacs/24.3/lisp/obsolete/iso-acc

Features:
(shadow emacsbug dabbrev parse-time sort smiley gnus-cite mail-extr
gnus-async gnus-bcklg qp gnus-agent gnus-srvr gnus-score score-mode
nnvirtual nntp gnus-ml gnus-msg gnus-art mm-uu mml2015 epg-config
mm-view mml-smime smime dig disp-table nndoc gnus-cache gnus-sum nnoo
url-handlers gnus-group gnus-undo nnmail mail-source gnus-start
gnus-spec gnus-int gnus-range gnus-win gnus gnus-ems nnheader mm-archive
message idna sendmail rfc822 mml mml-sec mailabbrev gmm-utils mailheader
crm debbugs-org debbugs-gnu wid-edit debbugs soap-client mm-decode
mm-bodies mm-encode xml debbugs-autoloads autoload tar-mode lisp-mnt
help-mode mail-utils network-stream starttls url-http tls mail-parse
rfc2231 rfc2047 rfc2045 ietf-drums url-gw url-cache url-auth url
url-proxy url-privacy url-expand url-methods url-history url-cookie
url-domsuf url-util mailcap finder-inf misearch multi-isearch goto-addr
thingatpt view org-table diary-lib diary-loaddefs org-element diff-mode
vc vc-dispatcher mule-util vc-rcs css-mode sgml-mode cc-langs dired
make-mode nxml-uchnm rng-xsd xsd-regexp rng-cmpct rng-nxml rng-valid
rng-loc rng-uri rng-parse nxml-parse rng-match rng-dt rng-util rng-pttrn
nxml-ns nxml-mode nxml-outln nxml-rap nxml-util nxml-glyph nxml-enc
xmltok edmacro kmacro org-wl org-w3m org-vm org-rmail org-mhe org-mew
org-irc org-jsinfo org-infojs org-html org-exp ob-exp org-exp-blocks
org-agenda org-info org-gnus org-docview org-bibtex bibtex org-bbdb org
ob-tangle ob-ref ob-lob ob-table org-footnote org-src ob-comint ob-keys
org-pcomplete org-list org-faces org-entities noutline outline
org-version ob-emacs-lisp ob org-compat org-macs ob-eval org-loaddefs
find-func cal-menu calendar cal-loaddefs jka-compr vc-git ack-autoloads
package desktop handheld-utils time server pgg pgg-parse pgg-def tramp
tramp-compat tramp-loaddefs shell pcomplete paren uniquify iswitchb ffap
url-parse auth-source eieio gnus-util mm-util mail-prsvr password-cache
url-vars git-blame format-spec git derived log-edit easy-mmode pcvs-util
add-log ewoc cc-mode cc-fonts cc-guess cc-menus cc-cmds cc-styles
cc-align cc-engine cc-vars cc-defs skeleton ispell bbbike-mode recode
byte-opt warnings mode-compile-kill mode-compile reporter pp cl-macs gv
cl bytecomp byte-compile cconv flymake compile comint ansi-color ring
cperl-mode easymenu advice help-fns cl-lib advice-preload autoinsert
time-date tooltip ediff-hook vc-hooks lisp-float-type mwheel x-win x-dnd
tool-bar dnd fontset image regexp-opt fringe tabulated-list newcomment
lisp-mode register page menu-bar rfn-eshadow timer select scroll-bar
mouse jit-lock font-lock syntax facemenu font-core frame cham georgian
utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean
japanese hebrew greek romanian slovak czech european ethiopic indian
cyrillic chinese case-table epa-hook jka-cmpr-hook help simple abbrev
minibuffer loaddefs button faces cus-face macroexp files text-properties
overlay sha1 md5 base64 format env code-pages mule custom widget
hashtable-print-readable backquote make-network-process dbusbind
dynamic-setting system-font-setting font-render-setting move-toolbar gtk
x-toolkit x multi-tty emacs)

-- 
Slaven Rezic - slaven <at> rezic <dot> de