repro.log #1

  • //
  • guest/
  • tom_tyler/
  • repro/
  • P4OpenedDisagreement/
  • repro.log
  • View
  • Commits
  • Open Download .zip Download (8 KB)
Started repro.sh v1.0.0 at Tue Aug 25 18:17:45 EDT 2026 in /Users/ttyler/pub/tt/repro/P4OpenedDisagreement.
ReproDir=/tmp/repro
==============================================================================
Scenario 1: p4 opened Disagreement after Remapped Path Injection


Preliminary info: Show versions of p4/p4d on the PATH:
Executing command: p4 -V
Perforce - The Fast Software Configuration Management System.
Copyright 1995-2026 Perforce Software.  All rights reserved.
This product includes software developed by the OpenSSL Project
for use in the OpenSSL Toolkit (http://www.openssl.org/)
Version of OpenSSL Libraries: OpenSSL 3.5.7 9 Jun 2026
See 'p4 help [ -l ] legal' for additional license information on
these licenses and others.
Extensions/scripting support built-in.
Parallel sync threading built-in.
Rev. P4/MACOSX12ARM64/2026.1/2972966 (2026/06/10).
Executing command: p4d -V
Perforce - The Fast Software Configuration Management System.
Copyright 1995-2026 Perforce Software.  All rights reserved.
This product includes software developed by the OpenSSL Project
for use in the OpenSSL Toolkit (http://www.openssl.org/)
Version of OpenSSL Libraries: OpenSSL 3.5.7 9 Jun 2026
This product includes software developed by the OpenLDAP Foundation
 (http://www.openldap.org/)
This product includes software developed by Computing Services
at Carnegie Mellon University: Cyrus SASL (http://www.cmu.edu/computing/)
Version of OpenLDAP Libraries: 2.5.20
Version of Cyrus SASL Libraries: 2.1.28
See 'p4 help [ -l ] legal' for additional license information on
these licenses and others.
Using no memory manager.
Rev. P4D/MACOSX12ARM64/2026.1/2972966 (2026/06/10).
License: none

Preliminary setup: Spin up a local repo.
Operating in: /tmp/repro
Executing command: p4 init -C0 -n
Server ttyler-dvcs-1787696265 saved.

After 'p4 init -C0 -n', the local repo should already have a stream depot named 'stream' and a mainline stream named //stream/main, along with a client workspace switched to that stream.
Executing command: p4 info
User name: ttyler
Client name: ttyler-dvcs-1787696265
Client root: /tmp/repro
Client stream: //stream/main
Current directory: /tmp/repro
Peer address: unknown
Client address: unknown
Server address: personal server created by 'init'
Server root: /tmp/repro/.p4root
Server date: 2026/08/25 18:17:45 -0400 EDT
Server uptime: 00:00:00
Server version: P4D/MACOSX12ARM64/2026.1/2972966 (2026/06/10)
ServerID: ttyler-dvcs-1787696265
Server services: local
Server license: none
Case Handling: sensitive
View:
	//stream/main/... //ttyler-dvcs-1787696265/...


==============================================================================
Scenario 1 setup: Add, submit, then open a file for edit.

Adding foo.txt at the top level of the stream.
Executing command: p4 add foo.txt
//stream/main/foo.txt#1 - opened for add
Executing command: p4 submit -d Add-foo.txt
Submitting change 1.
Locking 1 files ...
add //stream/main/foo.txt#1
Change 1 submitted.

Opening foo.txt for edit. This represents a normal in-progress checkout that a developer has not yet submitted.
Executing command: p4 edit foo.txt
//stream/main/foo.txt#1 - opened for edit

Sanity check: 'p4 opened' correctly reports the file as opened before we touch the stream spec.
Executing command: p4 opened
//stream/main/foo.txt#1 - edit default change (text)

==============================================================================
Scenario 2: Add a Remapped entry that injects 'extra_dir' at the top level.

The mainline stream generated by p4 init starts with a single ordinary shared stream path:

    Paths:
        share ...

This repro adds a Remapped entry that pushes everything down one level into extra_dir, without moving or renaming anything in the depot:

    Remapped:
        ... extra_dir/...

Modified //stream/main stream spec:
Stream:	//stream/main

Update:	2026/08/25 18:17:45

Access:	2026/08/25 18:17:45

Owner:	ttyler

Name:	//stream/main

Parent:	none

Type:	mainline

Description:
	Autocreated by switch command

Options:	allsubmit unlocked notoparent nofromparent mergeany

ParentView:	inherit

Paths:
	share ...


Remapped:
	... extra_dir/...
p4 -s stream -i < main.stream
info: Stream //stream/main saved.
exit: 0

//stream/main after update:
Stream:	//stream/main

Update:	2026/08/25 18:17:45

Access:	2026/08/25 18:17:45

Owner:	ttyler

Name:	//stream/main

Parent:	none

Type:	mainline

Description:
	Autocreated by switch command

Options:	allsubmit unlocked notoparent nofromparent mergeany

ParentView:	inherit

Paths:
	share ...

Remapped:
	... extra_dir/...


The client view now maps the stream's content one level deeper, into extra_dir:
View:
	//stream/main/... //ttyler-dvcs-1787696265/extra_dir/...


==============================================================================
Scenario 3: Sync to pick up the new view, then compare forms of 'p4 opened'.

Syncing picks up the new Remapped view. Note foo.txt is added again under extra_dir/, while the previously opened foo.txt at the old top-level location is left behind on disk.
Executing command: p4 sync
//stream/main/foo.txt#1 - added as /tmp/repro/extra_dir/foo.txt

Directory listing after the sync. Both the old top-level foo.txt (still opened for edit, orphaned relative to the new view) and the new extra_dir/foo.txt (freshly synced) exist on disk:
Executing command: ls -la .
total 40
drwxr-xr-x@   9 ttyler  wheel   288 Aug 25 18:17 .
drwxrwxrwt   56 root    wheel  1792 Aug 25 18:17 ..
-rw-r--r--@   1 ttyler  wheel   182 Aug 25 18:17 .p4config.local
-rw-r--r--@   1 ttyler  wheel    60 Aug 25 18:17 .p4ignore
drwx------@ 116 ttyler  wheel  3712 Aug 25 18:17 .p4root
drwxr-xr-x@   3 ttyler  wheel    96 Aug 25 18:17 extra_dir
-rw-r--r--@   1 ttyler  wheel    18 Aug 25 18:17 foo.txt
-rw-r--r--@   1 ttyler  wheel   324 Aug 25 18:17 main.stream
-rw-r--r--@   1 ttyler  wheel   294 Aug 25 18:17 main.stream.orig
Executing command: ls -la extra_dir
total 8
drwxr-xr-x@ 3 ttyler  wheel   96 Aug 25 18:17 .
drwxr-xr-x@ 9 ttyler  wheel  288 Aug 25 18:17 ..
-rw-r--r--@ 1 ttyler  wheel   18 Aug 25 18:17 foo.txt

--- Comparing forms of 'p4 opened' ---

'p4 opened' with no arguments:
File(s) not opened on this client.

'p4 opened //stream/main/foo.txt' with an explicit depot path:
//stream/main/foo.txt - file(s) not opened on this client.

'p4 opened ...' with a wildcard:
//stream/main/foo.txt#1 - edit default change (text)

'p4 opened -a' (all users/clients):
//stream/main/foo.txt#1 - edit default change (text) by ttyler@ttyler-dvcs-1787696265

For comparison, 'p4 fstat foo.txt' still shows the file as opened for edit, still rooted at the pre-Remapped client path (not under extra_dir):
Executing command: p4 fstat foo.txt
... depotFile //stream/main/foo.txt
... clientFile /tmp/repro/foo.txt
... haveRev 1
... action edit
... change default
... type text
... actionOwner ttyler
... workRev 1


==============================================================================
The Result:

Yay, we reproduced the disagreement!

After adding a Remapped stream path entry that injects 'extra_dir' at the top level, and syncing to pick up that new view, the workspace has a still-opened file (foo.txt, opened for edit before the Remapped change) that 'p4 opened' and 'p4 opened <depotpath>' wrongly report as NOT opened, while 'p4 opened ...' and 'p4 opened -a' correctly report it as opened.

This is not a case of the file simply falling outside the client view: it is a disagreement between different invocations of the same 'p4 opened' command on the same workspace at the same moment. The no-argument and explicit-depot-path forms appear to resolve against the file's stale, pre-Remapped client-relative path, while the wildcard/all-clients forms iterate opened records directly and find it regardless.

The practical impact: automation or scripts that call bare 'p4 opened' (or 'p4 opened <file>') to check for pending checkouts before doing something like 'p4 revert' or 'p4 sync -f' can be fooled into believing there is nothing opened, when in fact there is.
# Change User Description Committed
#1 33286 C. Thomas Tyler Add P4OpenedDisagreement repro.sh and repro.log