From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#63337: [PATCH] package-vc--build-documentation: Fix relative @include statements Date: Tue, 09 May 2023 07:36:42 +0300 Message-ID: <83sfc6azol.fsf@gnu.org> References: <87fs89qg9y.fsf@breatheoutbreathe.in> <87cz3cea4k.fsf@posteo.net> <87pm7c7zfs.fsf@breatheoutbreathe.in> <83zg6gc5yp.fsf@gnu.org> <87sfc8gd9s.fsf@posteo.net> <87fs877tgz.fsf@breatheoutbreathe.in> <875y936iec.fsf@posteo.net> <87y1lyhbfy.fsf@breatheoutbreathe.in> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="7937"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 63337@debbugs.gnu.org, philipk@posteo.net To: Joseph Turner Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue May 09 06:36:26 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pwF5N-0001p4-Ii for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 09 May 2023 06:36:25 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pwF53-0001wB-Mn; Tue, 09 May 2023 00:36:06 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pwF51-0001vw-7e for bug-gnu-emacs@gnu.org; Tue, 09 May 2023 00:36:04 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pwF50-0003iw-RE for bug-gnu-emacs@gnu.org; Tue, 09 May 2023 00:36:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pwF50-0004CH-AC for bug-gnu-emacs@gnu.org; Tue, 09 May 2023 00:36:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 09 May 2023 04:36:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 63337 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 63337-submit@debbugs.gnu.org id=B63337.168360695016114 (code B ref 63337); Tue, 09 May 2023 04:36:02 +0000 Original-Received: (at 63337) by debbugs.gnu.org; 9 May 2023 04:35:50 +0000 Original-Received: from localhost ([127.0.0.1]:42159 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pwF4n-0004Bp-Pa for submit@debbugs.gnu.org; Tue, 09 May 2023 00:35:50 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:55040) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pwF4l-0004Bb-Lw for 63337@debbugs.gnu.org; Tue, 09 May 2023 00:35:48 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pwF4f-0003dK-13; Tue, 09 May 2023 00:35:41 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=az8wvFMewX57+ymBjUep6Vhn5QpxShsSiLMs81p+XOk=; b=otXdj51xA4HB nuP2BMDnv30HFQ0RVCZthJbfofzI0ZKH1cdwecdTcjlijEQh6wPCONPL/FNawUPAyVyH3M6YQJ1db dCa91Mw+o2OWEtU/WWUdg7ujxgK9PW5qyXJ/XoL62Fn88wJ3BqKuX5VCFaQxmV+zxwtggQzDhvS1h V+fvUQXHHj4oZPumZNfF1T9jU7peaJv3QsMB+Wj7pOvoRAYcPolm8zJcTJrh0sBiozcGPOwGbKCUM E38MkitQo3JkmnIWg/qv3yZAFSwBdZ/jCeOl1TcyEUyMBvoIAY1Lsw6HEKe96RXs4jPg4/hjxckT4 kxKF5vpBl4LJwdI+3LTrOQ==; Original-Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pwF4e-00012C-M1; Tue, 09 May 2023 00:35:40 -0400 In-Reply-To: <87y1lyhbfy.fsf@breatheoutbreathe.in> (message from Joseph Turner on Mon, 08 May 2023 12:05:51 -0700) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:261381 Archived-At: > From: Joseph Turner > Cc: Eli Zaretskii , 63337@debbugs.gnu.org > Date: Mon, 08 May 2023 12:05:51 -0700 > > Note about the following two lines: > > + (file-path (expand-file-name file (package-desc-dir pkg-desc))) > + (default-directory (expand-file-name (file-name-directory file-path))) > > (package-desc-dir pkg-desc) may return a relative path with or without a > directory, e.g. "doc/manual.org" or "manual.org". In the latter case, > (file-name-directory "manual.org") would return `nil' and > (expand-file-name nil) would signal an error. > > Therefore, in the `file-path' `let'-binding, we first expand the return > value of (package-desc-dir pkg-desc) to ensure that it contains a directory. Please don't use "path" for anything that is not a PATH-style list of directory: the GNU Coding Standards frown on such usage. We use file-name instead. For the same reasons, please don't give your variables names that include "path" unless they are lists of directories. > --- a/lisp/emacs-lisp/package-vc.el > +++ b/lisp/emacs-lisp/package-vc.el > @@ -376,14 +376,17 @@ Package specs are loaded from trusted package archives." > FILE can be an Org file, indicated by its \".org\" extension, > otherwise it's assumed to be an Info file." > (let* ((pkg-name (package-desc-name pkg-desc)) > - (default-directory (package-desc-dir pkg-desc)) > + (file-path (expand-file-name file (package-desc-dir pkg-desc))) > + ;; `let'-bind `default-directory' to the directory containing the .org or .info FILE > + ;; so that makeinfo can resolve relative @include statements in the docs directory. > + (default-directory (expand-file-name (file-name-directory file-path))) There should be no reason to call expand-file-name in the last line, since the argument of file-name-directory is already expanded. Also, please make the comment lines shorter, preferably less than 75 columns. Thanks.