[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug #59079] msgfmt fails to write fails to UNC paths on Windows (patch)
From: |
Vaclav Slavik |
Subject: |
[bug #59079] msgfmt fails to write fails to UNC paths on Windows (patch) in 0.21 |
Date: |
Mon, 7 Sep 2020 13:26:13 -0400 (EDT) |
User-agent: |
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.1.2 Safari/605.1.15 |
URL:
<https://savannah.gnu.org/bugs/?59079>
Summary: msgfmt fails to write fails to UNC paths on Windows
(patch) in 0.21
Project: GNU gettext
Submitted by: vslavik
Submitted on: Mon 07 Sep 2020 05:26:12 PM UTC
Category: Translator tools
Severity: 3 - Normal
Item Group: None
Status: None
Privacy: Public
Assigned to: None
Open/Closed: Open
Discussion Lock: Any
_______________________________________________________
Details:
With 0.21's change to use fopen_supersede() in msgfmt, compiling directly to
unmounted shared folders on Windows via UNC paths (e.g.
\\localhost\sharedfolder) fails. I got multiple reports of this pretty
quickly, so it's not as obscure an edge case as one could be excused to
think.
This is because fopen_supersede() uses canonicalize_filename_mode() which
doesn't handle this situation correctly. While it has code in place to
recognize leading double-slash as being different from single-slash, and knows
that this applies to win32, that's it. It then traverses the entire path from
the root, stat()ing each path component - but the initial part, \\hostname, is
not stat()able, it's not a path; \\hostname\foo is the first real component.
Attached patch fixes this to the best of my understanding of how
canonicalize_filename_mode() works: it increases `prefix_len` (which is bound
to be 0 for \\paths) to cover the hostname component, and copies the hostname
part to `dest` as well - causing canonicalization to start at the first real
path component and keep the leading \\hostname\ bit constant.
I realize this is not strictly a gettext bug, but one in gnulib. If you think
it's inappropriate to post here, my apologies, and I'll submit directly, but I
thought it could be excused, because you're involved with the supersede
module, the immediate impact is on gettext's msgfmt, and honestly, I do feel
more than a bit out of my depth with gnulib, and am unsure about the
appropriate approach as gnulib seems to be mostly a helper library for GNU
folks.
_______________________________________________________
File Attachments:
-------------------------------------------------------
Date: Mon 07 Sep 2020 05:26:12 PM UTC Name:
canonicalize-fix-windows-unc-paths.patch Size: 750B By: vslavik
<http://savannah.gnu.org/bugs/download.php?file_id=49755>
_______________________________________________________
Reply to this item at:
<https://savannah.gnu.org/bugs/?59079>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/
- [bug #59079] msgfmt fails to write fails to UNC paths on Windows (patch) in 0.21,
Vaclav Slavik <=