Re: [PATCH 2/2] fs/ntfs3: keep PrintName not changed when creating symlink

From: Zhan Xusheng

Date: Mon Sep 28 2026 - 03:28:25 EST


On Sun, Sep 27, 2026 at 06:03:59PM +0000, Zhenyan Wang wrote:
> - /* Translate Windows '\' into Linux '/'. */
> - for (i = 0; i < err; i++) {
> - if (buffer[i] == '\\')
> - buffer[i] = '/';
> - }

ntfs_readlink_hlp() reads PrintName, for both tags:

case IO_REPARSE_TAG_MOUNT_POINT:
... MountPointReparseBuffer.PrintNameOffset ...
case IO_REPARSE_TAG_SYMLINK:
... SymbolicLinkReparseBuffer.PrintNameOffset ...

On a volume written by Windows that PrintName is the display form, so
its separator is '\' - "C:\Users\foo". Without this loop readlink()
hands that back verbatim and the whole string becomes one component.
The loop is after the switch, so junctions and mount points lose it too.

Keeping it, the first hunk alone already fixes the '/' case:

symlink target PrintName readlink
a/b a/b a/b
a\b a\b a/b

The second row cannot be fixed this way. A '\' in PrintName is either a
Windows separator or a literal character from Linux, and nothing in the
buffer tells them apart, so a round trip for the literal one needs a
different encoding, not a missing conversion.

Also, after the first hunk the is_absolute block still decorates through
rp_name while the copy is at sub_name; both point into the same buffer,
which is easy to get wrong later.