From mboxrd@z Thu Jan 1 00:00:00 1970 From: Carsten Dominik Subject: Re: [BUG] bug in org-publish and a (wrong) patch Date: Fri, 8 Apr 2011 12:22:15 +0200 Message-ID: References: <8052.1302153060@alphaville.dokosmarshall.org> Mime-Version: 1.0 (Apple Message framework v1084) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Return-path: Received: from [140.186.70.92] (port=46663 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Q88pc-0006xZ-Nl for emacs-orgmode@gnu.org; Fri, 08 Apr 2011 06:22:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Q88pa-0005i8-QA for emacs-orgmode@gnu.org; Fri, 08 Apr 2011 06:22:23 -0400 Received: from mail-ey0-f169.google.com ([209.85.215.169]:40818) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Q88pa-0005gp-Jn for emacs-orgmode@gnu.org; Fri, 08 Apr 2011 06:22:22 -0400 Received: by eyd9 with SMTP id 9so1072407eyd.0 for ; Fri, 08 Apr 2011 03:22:20 -0700 (PDT) In-Reply-To: <8052.1302153060@alphaville.dokosmarshall.org> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: nicholas.dokos@hp.com Cc: emacs-orgmode@gnu.org Hi Nick, I have not looked closely, but maybe you can use (expand-file-name .... (file-name-directory filename)) to fix this patch? Not sure, I have not spent any time on it. - Carsten On Apr 7, 2011, at 7:11 AM, Nick Dokos wrote: > org-publish-cache-ctime-of-src tries (but does not always succeed) to > deal with symlinks: file-symlink-p returns the target as a string, but > if the target is relative to the symlink, that's not going to fly. > e.g. if c is a symlink like this >=20 > /a/b/c->../d/f >=20 > then (file-symlink-p "/a/b/c") -> "../d/f" > but if the current directory is any place other than /a/b, the target > will not be found, the file attributes are going to be nil and > the function will blow up. >=20 > Here is a patch born of about 5 mins of contemplation. It solved my > immediate problem but it is certainly wrong. It breaks absolute = targets > (which I think are handled correctly by the original version). I'm not > even sure that it correctly handles *all* relative targets. It also > needs to treat the case of a non-existent symlink target (where > file-symlink-p returns t). >=20 > It might be safer also to check if the file attributes are > nil and deal with that, instead of blowing up. >=20 > --8<---------------cut here---------------start------------->8--- > diff --git a/lisp/org-publish.el b/lisp/org-publish.el > index e944eea..dd192d6 100644 > --- a/lisp/org-publish.el > +++ b/lisp/org-publish.el > @@ -1150,7 +1150,7 @@ Returns value on success, else nil." > (defun org-publish-cache-ctime-of-src (filename) > "Get the FILENAME ctime as an integer." > (let ((src-attr (file-attributes (if (stringp (file-symlink-p = filename)) > - (file-symlink-p filename) > + (concat (file-name-directory = filename) (file-symlink-p filename)) > filename)))) > (+ > (lsh (car (nth 5 src-attr)) 16) > --8<---------------cut here---------------end--------------->8--- >=20 > Nick >=20 - Carsten