NetBSD Problem Report #48864

From njoly@lanfeust.sis.pasteur.fr  Mon Jun  2 12:57:49 2014
Return-Path: <njoly@lanfeust.sis.pasteur.fr>
Received: from mail.netbsd.org (mail.netbsd.org [149.20.53.66])
	(using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits))
	(Client CN "mail.netbsd.org", Issuer "Postmaster NetBSD.org" (verified OK))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 2CBC3A5813
	for <gnats-bugs@gnats.NetBSD.org>; Mon,  2 Jun 2014 12:57:49 +0000 (UTC)
Message-Id: <20140602125415.89040E0639@lanfeust.sis.pasteur.fr>
Date: Mon,  2 Jun 2014 14:54:15 +0200 (CEST)
From: njoly@pasteur.fr
Reply-To: njoly@pasteur.fr
To: gnats-bugs@NetBSD.org
Subject: Incorrect symbolic link size on some filesystems
X-Send-Pr-Version: 3.95

>Number:         48864
>Category:       kern
>Synopsis:       Incorrect symbolic link size on some filesystems
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    hannken
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Jun 02 13:00:01 +0000 2014
>Closed-Date:    Sun Apr 18 09:10:28 +0000 2021
>Last-Modified:  Sun Apr 18 09:10:28 +0000 2021
>Originator:     Nicolas Joly
>Release:        NetBSD 6.99.43
>Organization:
Insitut Pasteur
>Environment:
System: NetBSD lanfeust.sis.pasteur.fr 6.99.43 NetBSD 6.99.43 (LANFEUST) #3: Mon Jun 2 11:29:06 CEST 2014 njoly@lanfeust.sis.pasteur.fr:/local/src/NetBSD/obj.amd64/sys/arch/amd64/compile/LANFEUST amd64
Architecture: x86_64
Machine: amd64
>Description:
According to the Opengroup online specification for lstat[1], for a symbolic
link, "the value of the st_size member shall be set to the length of the
pathname contained in the symbolic link not including any terminating null
byte."

At least tmpfs, udf and v7fs report wrong values for symlink size.

By example, tmpfs is off by one :

njoly@lanfeust [/tmp/lstat]> df -h .
Filesystem         Size       Used      Avail %Cap Mounted on
tmpfs              107G       7.0M       107G   0% /tmp
njoly@lanfeust [/tmp/lstat]> ln -s source destination
njoly@lanfeust [/tmp/lstat]> ls -l 
total 8
lrwxr-xr-x  1 njoly  wheel  7 Jun  2 14:30 destination -> source
njoly@lanfeust [/tmp/lstat]> stat -x destination
  File: "destination"
  Size: 7            FileType: Symbolic Link
  Mode: (0755/lrwxr-xr-x)         Uid: ( 1000/   njoly)  Gid: (    0/   wheel)
Device: 171,1   Inode: 85401585340920951    Links: 1
Access: Mon Jun  2 14:30:50 2014
Modify: Mon Jun  2 14:30:47 2014
Change: Mon Jun  2 14:30:47 2014

The reported size is 7 where it should be only 6.

[1] http://pubs.opengroup.org/onlinepubs/9699919799/functions/lstat.html

>How-To-Repeat:
Create a symbolic link on tmpfs/udf/v7fs filesystems and check its size.
>Fix:
Please.

>Release-Note:

>Audit-Trail:
From: "Nicolas Joly" <njoly@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/48864 CVS commit: src/tests/fs/vfs
Date: Tue, 3 Jun 2014 11:56:07 +0000

 Module Name:	src
 Committed By:	njoly
 Date:		Tue Jun  3 11:56:07 UTC 2014

 Modified Files:
 	src/tests/fs/vfs: t_vnops.c

 Log Message:
 Add testcase that check lstat(2) values for symbolic links (PR
 kern/48864).


 To generate a diff of this commit:
 cvs rdiff -u -r1.38 -r1.39 src/tests/fs/vfs/t_vnops.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

From: "Andreas Gustafsson" <gson@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/48864 CVS commit: src/sys/fs/tmpfs
Date: Mon, 8 Sep 2014 14:49:47 +0000

 Module Name:	src
 Committed By:	gson
 Date:		Mon Sep  8 14:49:47 UTC 2014

 Modified Files:
 	src/sys/fs/tmpfs: tmpfs_subr.c tmpfs_vnops.c

 Log Message:
 Store symlinks without a NUL terminator so that lstat(2) returns the
 correct length.  Fixes the tmpfs part of PR kern/48864.


 To generate a diff of this commit:
 cvs rdiff -u -r1.96 -r1.97 src/sys/fs/tmpfs/tmpfs_subr.c
 cvs rdiff -u -r1.120 -r1.121 src/sys/fs/tmpfs/tmpfs_vnops.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

From: "Andreas Gustafsson" <gson@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/48864 CVS commit: src/tests/fs/vfs
Date: Tue, 9 Sep 2014 06:51:01 +0000

 Module Name:	src
 Committed By:	gson
 Date:		Tue Sep  9 06:51:01 UTC 2014

 Modified Files:
 	src/tests/fs/vfs: t_vnops.c

 Log Message:
 Mark v7fs_lstat_symlink as an expected failure, referencing PR kern/48864.


 To generate a diff of this commit:
 cvs rdiff -u -r1.42 -r1.43 src/tests/fs/vfs/t_vnops.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

From: "SAITOH Masanobu" <msaitoh@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/48864 CVS commit: [netbsd-7] src/sys/fs/tmpfs
Date: Mon, 22 Dec 2014 02:05:08 +0000

 Module Name:	src
 Committed By:	msaitoh
 Date:		Mon Dec 22 02:05:08 UTC 2014

 Modified Files:
 	src/sys/fs/tmpfs [netbsd-7]: tmpfs_subr.c tmpfs_vnops.c

 Log Message:
 Pull up following revision(s) (requested by gson in ticket #344):
 	sys/fs/tmpfs/tmpfs_vnops.c: revision 1.121
 	sys/fs/tmpfs/tmpfs_subr.c: revision 1.97
 Store symlinks without a NUL terminator so that lstat(2) returns the
 correct length.  Fixes the tmpfs part of PR kern/48864.


 To generate a diff of this commit:
 cvs rdiff -u -r1.96 -r1.96.4.1 src/sys/fs/tmpfs/tmpfs_subr.c
 cvs rdiff -u -r1.120 -r1.120.2.1 src/sys/fs/tmpfs/tmpfs_vnops.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

From: "Juergen Hannken-Illjes" <hannken@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/48864 CVS commit: src/sys/fs/v7fs
Date: Mon, 29 Dec 2014 15:28:08 +0000

 Module Name:	src
 Committed By:	hannken
 Date:		Mon Dec 29 15:28:08 UTC 2014

 Modified Files:
 	src/sys/fs/v7fs: v7fs_vnops.c

 Log Message:
 v7fs_getattr: adjust size of symlinks by -1 to compensate the trailing NUL.

 Should fix the v7fs part of PR kern/48864.


 To generate a diff of this commit:
 cvs rdiff -u -r1.17 -r1.18 src/sys/fs/v7fs/v7fs_vnops.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

From: "Martin Husemann" <martin@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/48864 CVS commit: [netbsd-7] src/sys/fs/v7fs
Date: Wed, 7 Jan 2015 10:08:15 +0000

 Module Name:	src
 Committed By:	martin
 Date:		Wed Jan  7 10:08:15 UTC 2015

 Modified Files:
 	src/sys/fs/v7fs [netbsd-7]: v7fs_file.c v7fs_vfsops.c v7fs_vnops.c

 Log Message:
 Pull up following revision(s) (requested by hannken in ticket #386):
 	sys/fs/v7fs/v7fs_file.c: revision 1.6
 	sys/fs/v7fs/v7fs_vnops.c: revision 1.18
 	sys/fs/v7fs/v7fs_vnops.c: revision 1.19
 	sys/fs/v7fs/v7fs_vfsops.c: revision 1.11
 v7fs_getattr: adjust size of symlinks by -1 to compensate the trailing NUL.
 Should fix the v7fs part of PR kern/48864.
 Defer deallocating unlinked inodes to v7fs_reclaim().
 Remove v7fs_vnode_reload() and always use v7fs_inode_load().  No need
 to search for a vnode we already hold a reference on.


 To generate a diff of this commit:
 cvs rdiff -u -r1.5 -r1.5.12.1 src/sys/fs/v7fs/v7fs_file.c
 cvs rdiff -u -r1.10 -r1.10.2.1 src/sys/fs/v7fs/v7fs_vfsops.c
 cvs rdiff -u -r1.17 -r1.17.2.1 src/sys/fs/v7fs/v7fs_vnops.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

Responsible-Changed-From-To: kern-bug-people->hannken
Responsible-Changed-By: maya@NetBSD.org
Responsible-Changed-When: Sat, 17 Apr 2021 22:55:51 +0000
Responsible-Changed-Why:
Hi hannken, do you believe this issue is fixed?


From: "J. Hannken-Illjes" <hannken@eis.cs.tu-bs.de>
To: gnats-bugs@netbsd.org
Cc: "maya@netbsd.org" <maya@NetBSD.org>
Subject: Re: kern/48864 (Incorrect symbolic link size on some filesystems)
Date: Sun, 18 Apr 2021 10:12:29 +0200

 --Apple-Mail=_2715F0EB-A757-41ED-A11B-D041E759EB11
 Content-Transfer-Encoding: 7bit
 Content-Type: text/plain;
 	charset=us-ascii

 According to rump test t_vnops::lstat_symlink all file systems
 supported bu atf ( ext2fs ffs lfs msdosfs nfs p2k puffs rumpfs
 sysvbfs tmpfs udf v7fs zfs ) pass so I would say it is fixed.

 --
 J. Hannken-Illjes - hannken@eis.cs.tu-bs.de - TU Braunschweig

 --Apple-Mail=_2715F0EB-A757-41ED-A11B-D041E759EB11
 Content-Transfer-Encoding: 7bit
 Content-Disposition: attachment;
 	filename=signature.asc
 Content-Type: application/pgp-signature;
 	name=signature.asc
 Content-Description: Message signed with OpenPGP

 -----BEGIN PGP SIGNATURE-----

 iQEzBAEBCAAdFiEE2BL3ha7Xao4WUZVYKoaVJdNr+uEFAmB76e0ACgkQKoaVJdNr
 +uHR/AgAlHfrGhJ0WrIFJWaVTjW3MEVt5WEdNZmqRXtRB9OWbNQhGWCJOmXK4Nmh
 bky7N/bS7JFNkJMrPR73DdhGthnwrvVaFN+zGEbJvHExbHwj75bzT4P9d9cjZoHO
 /NKLpGfKymcHkW9vOLIPoQtcPpv/jQkUQLMaLtPqJdODL3SqUcm8PR2RykDS5gmj
 F5dLU4Pq8wsA7gZ9C29A+28wMq6tzquBOW+pCtw9dre1oN1eqI1a6rW6WuMpO2tu
 FNt8S4v27Q4gbZualD6fd2hghShkE6oKenpuzz9QbCXjpRe7BlsCD+Url4eR6oI8
 LSlemPgd9qcP7/BKjObHVAIuCN8Cyg==
 =5YQk
 -----END PGP SIGNATURE-----

 --Apple-Mail=_2715F0EB-A757-41ED-A11B-D041E759EB11--

State-Changed-From-To: open->closed
State-Changed-By: maya@NetBSD.org
State-Changed-When: Sun, 18 Apr 2021 09:10:28 +0000
State-Changed-Why:
Hannken reports this is fixed.


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.46 2020/01/03 16:35:01 leot Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2020 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.