Project

General

Profile

Actions

Bug #13542

closed

wsdiff can strip first character of pathnames

Added by Andy Fiddaman 11 months ago. Updated 11 months ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
tools - gate/build tools
Start date:
Due date:
% Done:

100%

Estimated time:
Difficulty:
Medium
Tags:
Gerrit CR:

Description

Depending on how it is invoked, wsdiff can strip the first character of pathnames in the output, reporting tc/motd instead of etc/motd for example.
This is a bug introduced with the fix for #13480

Actions #1

Updated by Andy Fiddaman 11 months ago

Before:

% wsdiff proto/root_i386{,-nd}
tc/motd

% wsdiff proto/root_i386{,-nd}/
tc/motd

% wsdiff proto/root_i386{,-nd}/usr/sbin
usr/sbin/smbadm

% wsdiff proto/root_i386{,-nd}/usr/sbin/
usr/sbin/smbadm

After the proposed change:

% wsdiff proto/root_i386{,-nd}
etc/motd

% wsdiff proto/root_i386{,-nd}/
etc/motd

% wsdiff proto/root_i386{,-nd}/usr/sbin
usr/sbin/smbadm

% wsdiff proto/root_i386{,-nd}/usr/sbin/
usr/sbin/smbadm
Actions #2

Updated by Electric Monk 11 months ago

  • Gerrit CR set to 1254
Actions #3

Updated by Andy Fiddaman 11 months ago

The problem here is that wsdiff tries to show relative path names for changed objects, removing everything up to the start of the proto root from the displayed name.
Before #13480 was integrated, this didn't work at all well for roots which had been moved because it relied on finding the magic root-<arch> string in the path in order to split it.

After #13480, the path to the proto root is found by trying to find genuix, going up a directory at a time and checking to see if it's in the expected place, which implies that the root has been found. However, in the case that the argument to wsdiff is the entire proto, genuix matches with a double slash in the name - i.e. /path/to/proto/root_i386-nd//kernel/amd64/genunix. The double slash means that the calculation of how many characters to strip from the reported path name is off by one which results in truncated output (first character missing).

The fix normalises the input argument by removing any trailing / characters.

Actions #4

Updated by Electric Monk 11 months ago

  • Status changed from In Progress to Closed
  • % Done changed from 0 to 100

git commit 6be183eef7ea336db825abd64d8b464ca990a38b

commit  6be183eef7ea336db825abd64d8b464ca990a38b
Author: Andy Fiddaman <omnios@citrus-it.co.uk>
Date:   2021-02-15T17:26:58.000Z

    13542 wsdiff can strip first character of pathnames
    Reviewed by: Jason King <jason.king@joyent.com>
    Approved by: Robert Mustacchi <rm@fingolfin.org>

Actions

Also available in: Atom PDF