mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Zhan Xusheng <zhanxusheng1024@gmail.com>
To: Zhenyan Wang <maximwang110@gmail.com>
Cc: Zhan Xusheng <zhanxusheng@xiaomi.com>,
	Konstantin Komarov <almaz.alexandrovich@paragon-software.com>,
	Christian Brauner <brauner@kernel.org>,
	ntfs3@lists.linux.dev, linux-fsdevel@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] fs/ntfs3: keep PrintName not changed when creating symlink
Date: Mon, 28 Sep 2026 15:28:00 +0800	[thread overview]
Message-ID: <20260928072801.13714-1-zhanxusheng@xiaomi.com> (raw)
In-Reply-To: <20260927180359.3867508-3-maximwang110@gmail.com>

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.

  reply	other threads:[~2026-09-28  7:28 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-27 18:03 [PATCH 0/2] fs/ntfs3: fixes for directory permission and symlink consistency Zhenyan Wang
2026-09-27 18:03 ` [PATCH 1/2] fs/ntfs3: clear FILE_ATTRIBUTE_READONLY bit when argument 'mode' contains write permission Zhenyan Wang
2026-09-27 18:03 ` [PATCH 2/2] fs/ntfs3: keep PrintName not changed when creating symlink Zhenyan Wang
2026-09-28  7:28   ` Zhan Xusheng [this message]
2026-09-28  8:03     ` Zhenyan Wang
2026-09-27 20:30 ` [PATCH 0/2] fs/ntfs3: fixes for directory permission and symlink consistency Zhenyan Wang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260928072801.13714-1-zhanxusheng@xiaomi.com \
    --to=zhanxusheng1024@gmail.com \
    --cc=almaz.alexandrovich@paragon-software.com \
    --cc=brauner@kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maximwang110@gmail.com \
    --cc=ntfs3@lists.linux.dev \
    --cc=zhanxusheng@xiaomi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®