NetBSD Problem Report #55365

From dholland@netbsd.org  Thu Jun 11 03:42:23 2020
Return-Path: <dholland@netbsd.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-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 94E9B1A9219
	for <gnats-bugs@gnats.NetBSD.org>; Thu, 11 Jun 2020 03:42:23 +0000 (UTC)
Message-Id: <20200611034223.3E60784D63@mail.netbsd.org>
Date: Thu, 11 Jun 2020 03:42:23 +0000 (UTC)
From: dholland@NetBSD.org
Reply-To: dholland@NetBSD.org
To: gnats-bugs@NetBSD.org
Subject: cvs(1) mishandles paths to other directories
X-Send-Pr-Version: 3.95

>Number:         55365
>Category:       bin
>Synopsis:       cvs(1) mishandles paths to other directories
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Jun 11 03:45:00 +0000 2020
>Last-Modified:  Thu Jun 11 05:45:01 +0000 2020
>Originator:     David A. Holland
>Release:        NetBSD 9.99.49 (20200310)
>Organization:
>Environment:
System: NetBSD macaran 9.99.49 NetBSD 9.99.49 (MACARAN) #59: Tue Mar 10 20:34:11 EDT 2020  dholland@macaran:/usr/src/sys/arch/amd64/compile/MACARAN amd64
Architecture: x86_64
Machine: amd64
>Description:

It appears that giving cvs diff files in other directories before
files in the current directory confuses it. I'm getting "cannot find
revision control file". May specifically involve paths with "..".

The effect is not limited to cvs diff; it also affects at least
annotate, log, and update. The effect on update is particularly
problematic because it doesn't fail but instead persuades itself the
file's been deleted upstream.

Also seen on 8.99 so affects at least -9, and given circumstances
probably goes back a lot further than that.

>How-To-Repeat:

% cd src/sys/kern
% echo abc >> vfs_vnops.c; echo abc >> ../sys/vnode.h
% cvs diff vfs_vnops.c
Index: vfs_vnops.c
===================================================================
RCS file: /cvsroot/src/sys/kern/vfs_vnops.c,v
retrieving revision 1.207
diff -r1.207 vfs_vnops.c
1233a1234
> abc
Exit 1
% cvs diff ../sys/vnode.h
Index: ../sys/vnode.h
===================================================================
RCS file: /cvsroot/src/sys/sys/vnode.h,v
retrieving revision 1.292
diff -r1.292 vnode.h
597a598
> abc
Exit 1
% cvs diff ../sys/vnode.h vfs_vnops.c
Index: ../sys/vnode.h
===================================================================
RCS file: /cvsroot/src/sys/sys/vnode.h,v
retrieving revision 1.292
diff -r1.292 vnode.h
597a598
> abc
cvs diff: cannot find revision control file for vfs_vnops.c
Exit 1
% 

>Fix:

Dunno. Putting the file in the current directory first eliminates the
problem. Asking for ./vfs_vnops.c does not, but ../kern/vfs_vnops.c
does.

>Audit-Trail:
From: mlelstv@serpens.de (Michael van Elst)
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: bin/55365: cvs(1) mishandles paths to other directories
Date: Thu, 11 Jun 2020 05:42:34 -0000 (UTC)

 dholland@NetBSD.org writes:

 >RCS file: /cvsroot/src/sys/kern/vfs_vnops.c,v
 >RCS file: /cvsroot/src/sys/sys/vnode.h,v

 >% cvs diff ../sys/vnode.h vfs_vnops.c
 >Index: ../sys/vnode.h
 >===================================================================
 >RCS file: /cvsroot/src/sys/sys/vnode.h,v
 >retrieving revision 1.292
 >diff -r1.292 vnode.h
 >597a598
 >> abc
 >cvs diff: cannot find revision control file for vfs_vnops.c


 A trace of the CVS server shows that while it opens the first file

 /cvsroot/src/sys/sys/vnode.h,v

 it tries to look at the second file in the wrong directory:

 /cvsroot/vfs_vnops.c,v


 cvs -t shows that the server uses the wrong directory for vfs_vnops.c

   -> main: Session ID is 0VJFIGTWwtdwqLbC
   -> main loop with CVSROOT=/cvsroot
   -> open_connection_to_server (:ext:mlelstv@cvs.netbsd.org/cvsroot)
  -> Starting server: ssh -l mlelstv -- cvs.netbsd.org cvs server 
 S -> serve_directory (../sys)
 S -> dirswitch (../sys, /cvsroot/src/sys/sys)
 S -> serve_directory (.)
 S -> dirswitch (., /cvsroot/src/sys/kern)
 S -> serve_directory (.)
 S -> dirswitch (., /cvsroot/)
 S -> do_cvs_command (diff)
 S -> server_notify()
 S -> server_pathname_check (../sys/vnode.h)
 S -> server_pathname_check (vfs_vnops.c)

 S -> Reader_Lock(/cvsroot/src/sys/sys)
 S -> time_stamp_server (vnode.h, 1.296, =, (null))
 S -> diff_file_nodiff (../sys/vnode.h, 3)
 S -> Simple_Lock_Cleanup()

 S -> rename(CVS/Entries.Backup,CVS/Entries)
 S -> unlink_file(CVS/Entries.Log)

 S -> Reader_Lock(/cvsroot)                                <----------
 S -> time_stamp_server (vfs_vnops.c, 1.212, =, (null))
 cvs diff: cannot find revision control file for vfs_vnops.c
 S -> Simple_Lock_Cleanup()

   -> close_connection_to_server ()
 S -> Lock_Cleanup()
 S -> Simple_Lock_Cleanup()
 S -> server_cleanup()


 The client sends the commands

 UseUnchanged
 Command-prep diff
 Global_option -t
 Argument --
 Max-dotdot 1
 Directory ../sys
 src/sys/sys
 Entry /vnode.h/1.296///
 Unchanged vnode.h
 Directory .
 src/sys/kern
 Entry /vfs_vnops.c/1.212///
 Unchanged vfs_vnops.c
 Directory .
 Argument ../sys/vnode.h
 Argument vfs_vnops.c
 diff

 So that looks like a server-side bug.


 -- 
 -- 
                                 Michael van Elst
 Internet: mlelstv@serpens.de
                                 "A potential Snark may lurk in every tree."

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.