Bug 246936

Summary: doc.docbook.mk: Fix LATESTREVISION determination, causes build failure on non-English locales
Product: Documentation Reporter: Olivier Certner <olce>
Component: Books & ArticlesAssignee: Daniel Ebdrup Jensen <debdrup>
Status: Closed FIXED    
Severity: Affects Some People CC: debdrup
Priority: --- Keywords: patch
Version: Latest   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
Patch fixing LATESTREVISION determination
none
Updated patch
none
Updated patch
none
Updated patch none

Description Olivier Certner freebsd_committer freebsd_triage 2020-06-02 13:10:03 UTC
Created attachment 215164 [details]
Patch fixing LATESTREVISION determination

Hi,

Please find attach a patch that fixes LATESTREVISION determination, which actually fixes "manual" articles/books build (i.e., typing `make` in the right directory).

The current code has two problems:
1. Git or SVN information retrieval depends on the current locale, and doesn't work with non-English ones.
2. Fallback for LATESTREVISION most of the time (sometimes works, probable race) itself fails because PWD is set to document's directory + '/obj', but sources are in the document's directory.

Point 2 is the most annoying because documentation builds simply fails (`xsltproc` becomes unable to resolve 'latestrevision.*' variables in, e.g., articles). But point 2's failure appears only because of point 1's failure, which doesn't happen on a machine with English or C locale.

Thanks.
Comment 1 Olivier Certner freebsd_committer freebsd_triage 2021-01-19 12:12:55 UTC
Created attachment 221737 [details]
Updated patch

Produced by git on top of f2a33a330d5ac238aa9b2f1c4fadb9f7265577d5.
Comment 2 Daniel Ebdrup Jensen freebsd_committer freebsd_triage 2021-01-19 12:52:25 UTC
Yoink.
Comment 3 Daniel Ebdrup Jensen freebsd_committer freebsd_triage 2021-01-19 13:06:21 UTC
This doesn't get cleanly applied by 'git am' - could you please check that it does so locally?
Comment 4 Olivier Certner freebsd_committer freebsd_triage 2021-01-19 14:10:37 UTC
Created attachment 221741 [details]
Updated patch
Comment 5 Olivier Certner freebsd_committer freebsd_triage 2021-01-19 14:15:25 UTC
Created attachment 221742 [details]
Updated patch

On top of git rev f2a33a330d5ac238aa9b2f1c4fadb9f7265577d5.

Use "git am" to apply.
Comment 6 Daniel Ebdrup Jensen freebsd_committer freebsd_triage 2021-01-19 14:19:35 UTC
Patch now applies cleanly, and has been tested with both the C.UTF-8 and da_DK.UTF-8 locales.
Comment 7 commit-hook freebsd_committer freebsd_triage 2021-01-19 14:20:35 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/doc/commit/?id=1e7c4a3928bf3b7d5edd89d6d8d02b8cbf0c865c

commit 1e7c4a3928bf3b7d5edd89d6d8d02b8cbf0c865c
Author:     Olivier Certner <olce.freebsd@certner.fr>
AuthorDate: 2021-01-19 12:04:38 +0000
Commit:     Daniel Ebdrup Jensen <debdrup@FreeBSD.org>
CommitDate: 2021-01-19 14:18:40 +0000

    doc.docbook.mk: Fix LATESTREVISION determination, causes build failure on non-English locales

    Fixes, e.g., manual articles/books build (i.e., typing `make` in the right
    directory).

    There were two problems:
    1. Git or SVN information retrieval depends on the current locale, and doesn't
    work with non-English ones.
    2. Fallback for LATESTREVISION most of the time (sometimes works, probable
    race) itself fails because PWD is set to document's directory + '/obj', but
    sources are in the document's directory.

    Problem 2 is the most annoying because documentation builds simply fails
    (`xsltproc` becomes unable to resolve 'latestrevision.*' variables in, e.g.,
    articles). But point 2's failure appears only because of point 1's failure,
    which doesn't happen on a machine with English or C locale.

    PR: 246936

 share/mk/doc.docbook.mk | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
Comment 8 Daniel Ebdrup Jensen freebsd_committer freebsd_triage 2021-01-19 14:21:55 UTC
Thank you for your attention to detail. :)