NetBSD Problem Report #57735

From www@netbsd.org  Thu Nov 30 00:08:35 2023
Return-Path: <www@netbsd.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits))
	(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 023801A9238
	for <gnats-bugs@gnats.NetBSD.org>; Thu, 30 Nov 2023 00:08:35 +0000 (UTC)
Message-Id: <20231130000834.1DF1A1A9239@mollari.NetBSD.org>
Date: Thu, 30 Nov 2023 00:08:34 +0000 (UTC)
From: jlduran@gmail.com
Reply-To: jlduran@gmail.com
To: gnats-bugs@NetBSD.org
Subject: mtree: FreeBSD unsubmitted patches
X-Send-Pr-Version: www-1.0

>Number:         57735
>Category:       bin
>Synopsis:       mtree: FreeBSD unsubmitted patches
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bin-bug-people
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Thu Nov 30 00:10:00 +0000 2023
>Last-Modified:  Sat Dec 02 16:15:01 +0000 2023
>Originator:     Jose Luis Duran
>Release:        trunk
>Organization:
>Environment:
>Description:
While synchronizing the copy of mtree in FreeBSD, I discovered that these three patches have not been upstreamed.

1. mtree -f file1 -f file2 does not consider type changes.
2. Add a cross reference to mtree(5), so mtree(5) <-> mtree(8).
3. fts_read: Handle error from NULL return.

>How-To-Repeat:

>Fix:
1. https://github.com/freebsd/freebsd-src/commit/4f4b548b1d21ae16955b09f9b717524167a7d97e
2. https://github.com/freebsd/freebsd-src/commit/da232c04ab9eba3d3a7fc73881daff847071e9fd
3. https://github.com/freebsd/freebsd-src/commit/2dfa4b66b3d0caaaae6ce2df476b5615f8415a19

Let me know if a GitHub pull request or an email with the patches are mandatory, and I'll gladly submit them.
They are all rather trivial.
Thank you.

>Audit-Trail:
From: "Christos Zoulas" <christos@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/57735 CVS commit: src
Date: Sat, 2 Dec 2023 08:24:00 -0500

 Module Name:	src
 Committed By:	christos
 Date:		Sat Dec  2 13:24:00 UTC 2023

 Modified Files:
 	src/tests/usr.sbin/mtree: t_mtree.sh
 	src/usr.sbin/mtree: specspec.c

 Log Message:
 PR/57735: Jose Louis Duran: mtree -f file1 -f file2 does not consider type
 changes.
 (FreeBSD https://github.com/freebsd/freebsd-src/commit/\
     4f4b548b1d21ae16955b09f9b717524167a7d97e)


 To generate a diff of this commit:
 cvs rdiff -u -r1.8 -r1.9 src/tests/usr.sbin/mtree/t_mtree.sh
 cvs rdiff -u -r1.4 -r1.5 src/usr.sbin/mtree/specspec.c

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

From: "Christos Zoulas" <christos@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/57735 CVS commit: src/usr.sbin/mtree
Date: Sat, 2 Dec 2023 08:26:09 -0500

 Module Name:	src
 Committed By:	christos
 Date:		Sat Dec  2 13:26:09 UTC 2023

 Modified Files:
 	src/usr.sbin/mtree: mtree.8

 Log Message:
 PR/57735: Jose Louis Duran: Add missing xref to mtree.5
 (FreeBSD commit https://github.com/freebsd/freebsd-src/commit/\
     da232c04ab9eba3d3a7fc73881daff847071e9fd)


 To generate a diff of this commit:
 cvs rdiff -u -r1.77 -r1.78 src/usr.sbin/mtree/mtree.8

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

From: "Christos Zoulas" <christos@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/57735 CVS commit: src/usr.sbin/mtree
Date: Sat, 2 Dec 2023 08:34:48 -0500

 Module Name:	src
 Committed By:	christos
 Date:		Sat Dec  2 13:34:48 UTC 2023

 Modified Files:
 	src/usr.sbin/mtree: create.c verify.c

 Log Message:
 PR/57735: Jose Louis Duran: check if fts_read(3) had an error.
 (FreeBSD commit https://github.com/freebsd/freebsd-src/commit/\
     2dfa4b66b3d0caaaae6ce2df476b5615f8415a19)


 To generate a diff of this commit:
 cvs rdiff -u -r1.76 -r1.77 src/usr.sbin/mtree/create.c
 cvs rdiff -u -r1.47 -r1.48 src/usr.sbin/mtree/verify.c

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

From: Christos Zoulas <christos@zoulas.com>
To: gnats-bugs@netbsd.org
Cc: gnats-admin@netbsd.org,
 netbsd-bugs@netbsd.org
Subject: Re: bin/57735: mtree: FreeBSD unsubmitted patches
Date: Sat, 2 Dec 2023 08:36:56 -0500

 Thank you! I don't understand why we need to set errno to 0 before =
 calling fts_read()
 because it is supposed to do it so I did not. Is it necessary?

 Best,

 christos=

From: Jose Luis Duran <jlduran@gmail.com>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: bin/57735: mtree: FreeBSD unsubmitted patches
Date: Sat, 2 Dec 2023 12:16:09 -0300

 --00000000000002492b060b885e2e
 Content-Type: text/plain; charset="UTF-8"
 Content-Transfer-Encoding: quoted-printable

 On Sat, Dec 2, 2023 at 10:40=E2=80=AFAM Christos Zoulas <christos@zoulas.co=
 m> wrote:

 >  Thank you! I don't understand why we need to set errno to 0 before
 > calling fts_read()
 >  because it is supposed to do it so I did not. Is it necessary?
 >

 Reading the commit message:

 > This is addressing cases such as fts_read(3) encountering an [EIO]
 > from fchdir(2) when FTS_NOCHDIR is not set. That would otherwise be
 > seen as a successful traversal in some of these cases while silently
 > discarding expected work.

 > As noted in
 > [
 https://github.com/freebsd/freebsd-src/commit/73a0af46b854be94a05fcc4d46036=
 19a00ac5707
 ]
 > fts_read() does not set errno to 0 on a successful
 > EOF so it needs to be set before calling it. Otherwise we might see
 > a random error from one of the iterations.

 ...made me take a look at fts.c in NetBSD, and your commit:
 https://github.com/NetBSD/src/commit/b53fea69d008d28365e2dd90e145beaaa53528=
 78
 gave me an idea of what I should do next.

 In short, for NetBSD, there should be no need, the commit is good. For
 FreeBSD, there is the corner case described in the commit message above, so
 I need to fix a few things before (or at least try)! In the meantime, I'll
 keep it just for FreeBSD.

 Thank you!

 --00000000000002492b060b885e2e
 Content-Type: text/html; charset="UTF-8"
 Content-Transfer-Encoding: quoted-printable

 <div dir=3D"ltr"><div dir=3D"ltr">On Sat, Dec 2, 2023 at 10:40=E2=80=AFAM C=
 hristos Zoulas &lt;<a href=3D"mailto:christos@zoulas.com">christos@zoulas.c=
 om</a>&gt; wrote:</div><div class=3D"gmail_quote"><blockquote class=3D"gmai=
 l_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left-width:1px;border-lef=
 t-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">
 =C2=A0Thank you! I don&#39;t understand why we need to set errno to 0 befor=
 e calling fts_read()<br>
 =C2=A0because it is supposed to do it so I did not. Is it necessary?<br></b=
 lockquote><div><br></div><div>Reading the commit message:<br></div><div><br=
 ></div>&gt; This is addressing cases such as fts_read(3) encountering an [E=
 IO]<br>&gt; from fchdir(2) when FTS_NOCHDIR is not set. That would otherwis=
 e be<br>&gt; seen as a successful traversal in some of these cases while si=
 lently<br>&gt; discarding expected work.<br><br>&gt; As noted in</div><div =
 class=3D"gmail_quote">&gt; [<a href=3D"https://github.com/freebsd/freebsd-s=
 rc/commit/73a0af46b854be94a05fcc4d4603619a00ac5707">https://github.com/free=
 bsd/freebsd-src/commit/73a0af46b854be94a05fcc4d4603619a00ac5707</a>]</div><=
 div class=3D"gmail_quote">&gt; fts_read() does not set errno to 0 on a succ=
 essful<br>&gt; EOF so it needs to be set before calling it. Otherwise we mi=
 ght see<br><div>&gt; a random error from one of the iterations.</div><div><=
 br></div><div>...made me take a look at fts.c in NetBSD, and your commit: <=
 a href=3D"https://github.com/NetBSD/src/commit/b53fea69d008d28365e2dd90e145=
 beaaa5352878">https://github.com/NetBSD/src/commit/b53fea69d008d28365e2dd90=
 e145beaaa5352878</a> gave me an idea of what I should do next.</div><div><b=
 r></div><div>In short, for NetBSD, there should be no need, the commit is g=
 ood. For FreeBSD, there is the corner case described in the commit message =
 above, so I need to fix a few things before (or at least try)! In the meant=
 ime, I&#39;ll keep it just for FreeBSD.</div><div><br></div><div>Thank you!=
 </div></div></div>

 --00000000000002492b060b885e2e--

From: Christos Zoulas <christos@zoulas.com>
To: gnats-bugs@netbsd.org
Cc: gnats-admin@netbsd.org,
 netbsd-bugs@netbsd.org,
 jlduran@gmail.com
Subject: Re: bin/57735: mtree: FreeBSD unsubmitted patches
Date: Sat, 2 Dec 2023 11:07:55 -0500

 Thanks for the explanation. I had completely forgotten about that commit :-)

 Best,

 christos

From: Jose Luis Duran <jlduran@gmail.com>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: bin/57735: mtree: FreeBSD unsubmitted patches
Date: Sat, 2 Dec 2023 13:12:46 -0300

 --0000000000009258bd060b892808
 Content-Type: text/plain; charset="UTF-8"
 Content-Transfer-Encoding: quoted-printable

 There is one last thing, the test has its body duplicated? At least that's
 what I can gather from:
 http://cvsweb.netbsd.org/bsdweb.cgi/src/tests/usr.sbin/mtree/t_mtree.sh.dif=
 f?r1=3D1.8&r2=3D1.9&f=3Dh&only_with_tag=3DMAIN

 Please disregard if this is not true.
 Regards,

 On Sat, Dec 2, 2023 at 1:10=E2=80=AFPM Christos Zoulas <christos@zoulas.com=
 > wrote:

 > The following reply was made to PR bin/57735; it has been noted by GNATS.
 >
 > From: Christos Zoulas <christos@zoulas.com>
 > To: gnats-bugs@netbsd.org
 > Cc: gnats-admin@netbsd.org,
 >  netbsd-bugs@netbsd.org,
 >  jlduran@gmail.com
 > Subject: Re: bin/57735: mtree: FreeBSD unsubmitted patches
 > Date: Sat, 2 Dec 2023 11:07:55 -0500
 >
 >  Thanks for the explanation. I had completely forgotten about that commit
 > :-)
 >
 >  Best,
 >
 >  christos
 >
 >

 --0000000000009258bd060b892808
 Content-Type: text/html; charset="UTF-8"
 Content-Transfer-Encoding: quoted-printable

 <div dir=3D"ltr"><div dir=3D"ltr">There is one last thing, the test has its=
  body duplicated? At least that&#39;s what I can gather from:</div><a href=
 =3D"http://cvsweb.netbsd.org/bsdweb.cgi/src/tests/usr.sbin/mtree/t_mtree.sh=
 .diff?r1=3D1.8&amp;r2=3D1.9&amp;f=3Dh&amp;only_with_tag=3DMAIN">http://cvsw=
 eb.netbsd.org/bsdweb.cgi/src/tests/usr.sbin/mtree/t_mtree.sh.diff?r1=3D1.8&=
 amp;r2=3D1.9&amp;f=3Dh&amp;only_with_tag=3DMAIN</a><div><br></div><div>Plea=
 se disregard if this is not true.</div><div>Regards,</div><div><br><div cla=
 ss=3D"gmail_quote"><div dir=3D"ltr" class=3D"gmail_attr">On Sat, Dec 2, 202=
 3 at 1:10=E2=80=AFPM Christos Zoulas &lt;<a href=3D"mailto:christos@zoulas.=
 com">christos@zoulas.com</a>&gt; wrote:<br></div><blockquote class=3D"gmail=
 _quote" style=3D"margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left=
 -style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">The follo=
 wing reply was made to PR bin/57735; it has been noted by GNATS.<br>
 <br>
 From: Christos Zoulas &lt;<a href=3D"mailto:christos@zoulas.com" target=3D"=
 _blank">christos@zoulas.com</a>&gt;<br>
 To: <a href=3D"mailto:gnats-bugs@netbsd.org" target=3D"_blank">gnats-bugs@n=
 etbsd.org</a><br>
 Cc: <a href=3D"mailto:gnats-admin@netbsd.org" target=3D"_blank">gnats-admin=
 @netbsd.org</a>,<br>
 =C2=A0<a href=3D"mailto:netbsd-bugs@netbsd.org" target=3D"_blank">netbsd-bu=
 gs@netbsd.org</a>,<br>
 =C2=A0<a href=3D"mailto:jlduran@gmail.com" target=3D"_blank">jlduran@gmail.=
 com</a><br>
 Subject: Re: bin/57735: mtree: FreeBSD unsubmitted patches<br>
 Date: Sat, 2 Dec 2023 11:07:55 -0500<br>
 <br>
 =C2=A0Thanks for the explanation. I had completely forgotten about that com=
 mit :-)<br>
 <br>
 =C2=A0Best,<br>
 <br>
 =C2=A0christos<br>
 <br>
 </blockquote></div></div></div>

 --0000000000009258bd060b892808--

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.47 2022/09/11 19:34:41 kim Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2023 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.