svn switch, touches files with svn:keywords

3 views
Skip to first unread message

FEDERICO PRADES ILLANES

unread,
Sep 23, 2016, 6:47:45 AM9/23/16
to us...@subversion.apache.org
Hello subversion-users,

I think I found a bug in subversion, not in the issue tracker:

Subversion: svn, version 1.9.4 (r1740329)
   compiled Apr 24 2016, 15:40:35 on x86-microsoft-windows
System: Windows 7, SP1

Steps to reproduce:
  1. Create a branch b1.
  2. Create an dummy file in b1, with svn:keywords.
  3. Don't use the svn:keywords on the file.
  4. Commit the changes to b1.
  5. Create a branch b2, from b1.
  6. Perform a switch to b2.
Expected results:
  • Dummy file modification time hasn't change
Actual results
  • Dummy file modification time has change
This is a problem specially with header files, in C++ projects. This bug wasn't present in svn 1.7.9 r1462340.

Can someone else confirm, and will proceed to open the issue.

Thanks,

Federico Prades Illanes - ext. (2)75682 - Software Evangelist
Quantitative and Business Solutions (QBS) - CIB - BBVA

"Este mensaje está dirigido de manera exclusiva a su destinatario y puede contener información privada y confidencial. No lo reenvíe, copie o distribuya a terceros que no deban conocer su contenido. En caso de haberlo recibido por error,  rogamos lo notifique al remitente y proceda a su borrado, así como al de cualquier documento que pudiera adjuntarse.

 Por favor tenga en cuenta que los correos enviados vía Internet no permiten garantizar la confidencialidad de los mensajes ni su transmisión de forma íntegra.

 Las opiniones expresadas en el presente correo pertenecen únicamente al remitente y no representan necesariamente la opinión del Grupo BBVA."

 "This message is intended exclusively for the adressee and may contain privileged and confidential information. Please, do not disseminate, copy or distribute it to third parties who should not receive it. In case you have received it by mistake, please inform the sender and delete the message and attachments from your system.

 Please keep in mind that e-mails sent by Internet do not allow to guarantee neither the confidentiality or the integrity of the messages sent."

Nico Kadel-Garcia

unread,
Sep 23, 2016, 6:53:55 PM9/23/16
to FEDERICO PRADES ILLANES, Subversion
On Fri, Sep 23, 2016 at 6:36 AM, FEDERICO PRADES ILLANES
<federic...@bbva.com> wrote:
> Hello subversion-users,
>
> I think I found a bug in subversion, not in the issue tracker:
>
> Subversion: svn, version 1.9.4 (r1740329)
> compiled Apr 24 2016, 15:40:35 on x86-microsoft-windows
> System: Windows 7, SP1
>
> Steps to reproduce:
>
> Create a branch b1.
> Create an dummy file in b1, with svn:keywords.
> Don't use the svn:keywords on the file.
> Commit the changes to b1.
> Create a branch b2, from b1.
> Perform a switch to b2.
>
> Expected results:
>
> Dummy file modification time hasn't change
>
> Actual results
>
> Dummy file modification time has change
>
> This is a problem specially with header files, in C++ projects. This bug
> wasn't present in svn 1.7.9 r1462340.
>
> Can someone else confirm, and will proceed to open the issue.
>
> Thanks,
>
> Federico Prades Illanes - ext. (2)75682 - Software Evangelist
> Quantitative and Business Solutions (QBS) - CIB - BBVA

I didn't expect it, but I'm completely unsurprised. svn:keywords have
to rendered, and switching an upstream repository, branch, tag, etc.,
etc. can all change the WebURL, Author, Date, and other keywords. So
I'd be completely unsurprised if all files with svn:keywords get
reparsed and touched, even if no change results in the end.

Tis is one of the fragilities of keywords in all source control
systems. innocuous changes with no change in performance lead to
modifications of source files, even such innocuous changes as comment
lines.

Daniel Shahaf

unread,
Sep 24, 2016, 3:12:31 AM9/24/16
to FEDERICO PRADES ILLANES, us...@subversion.apache.org
FEDERICO PRADES ILLANES wrote on Fri, Sep 23, 2016 at 12:36:24 +0200:
> Steps to reproduce:
>
> 1. Create a branch b1.
> 2. Create an dummy file in b1, with svn:keywords.
> 3. Don't use the svn:keywords on the file.
> 4. Commit the changes to b1.
> 5. Create a branch b2, from b1.
> 6. Perform a switch to b2.
>
> Expected results:
>
> - Dummy file modification time hasn't change
>
> Actual results
>
> - Dummy file modification time has change

I can reproduce this with current trunk and I agree it's a (minor) bug.

Minimal reproduction:

svn co -q $URL wc
cd wc
touch iota
svn add iota
svn ps -q svn:keywords Id iota
svn ci -q -mr1
svn up -q
stat iota
svn switch ^/iota iota
stat iota

> This is a problem specially with header files, in C++ projects. This bug
> wasn't present in svn 1.7.9 r1462340.
>
> Can someone else confirm, and will proceed to open the issue.

Confirmed. Thanks for the clear bug report1

Daniel

Lorenz

unread,
Sep 26, 2016, 2:05:04 AM9/26/16
to us...@subversion.apache.org
Daniel Shahaf wrote:

>FEDERICO PRADES ILLANES wrote on Fri, Sep 23, 2016 at 12:36:24 +0200:
>> Steps to reproduce:
>>
>> 1. Create a branch b1.
>> 2. Create an dummy file in b1, with svn:keywords.
>> 3. Don't use the svn:keywords on the file.
>> 4. Commit the changes to b1.
>> 5. Create a branch b2, from b1.
>> 6. Perform a switch to b2.
>>
>> Expected results:
>>
>> - Dummy file modification time hasn't change
>>
>> Actual results
>>
>> - Dummy file modification time has change
>
>I can reproduce this with current trunk and I agree it's a (minor) bug.
>[...]

are you sure about tha being a bug?

If for instance in the file the URL keyword is used to initialize a
string variable, wouldn't you want the file to be recompiled after the
switch?
--

Lorenz

Daniel Shahaf

unread,
Sep 26, 2016, 3:37:56 AM9/26/16
to Lorenz, us...@subversion.apache.org
Lorenz wrote on Mon, Sep 26, 2016 at 06:01:31 +0000:
> are you sure about tha being a bug?
>
> If for instance in the file the URL keyword is used to initialize a
> string variable, wouldn't you want the file to be recompiled after the
> switch?

You are describing a different scenario than the OP.

In the OP's scenario, the file content with keywords expanded was the
same before and after the switch, yet the mtime differed. I consider
that a bug.

If the file content with keywords expanded had been different before the
switch to after to the switch, then yes, I would have expected the mtime
to differ, too.

Thanks for contributing this observation: the key question is whether
the translated content was modified, not whether the repository-normal
content was.

Cheers

Daniel

FEDERICO PRADES ILLANES

unread,
Sep 26, 2016, 4:13:45 AM9/26/16
to Daniel Shahaf, Lorenz, us...@subversion.apache.org


Federico Prades Illanes - ext. (2)75682 - Software Evangelist
Quantitative and Business Solutions (QBS) - CIB - BBVA

Lorenz

unread,
Sep 26, 2016, 4:34:52 AM9/26/16
to us...@subversion.apache.org
Daniel Shahaf wrote:

>Lorenz wrote on Mon, Sep 26, 2016 at 06:01:31 +0000:
>> are you sure about tha being a bug?
>>
>> If for instance in the file the URL keyword is used to initialize a
>> string variable, wouldn't you want the file to be recompiled after the
>> switch?
>
>You are describing a different scenario than the OP.
>[...]

ah yes, I overlooked "3. Don't use the svn:keywords on the file."
--

Lorenz

Bert Huijben

unread,
Sep 26, 2016, 7:32:56 AM9/26/16
to Daniel Shahaf, FEDERICO PRADES ILLANES, us...@subversion.apache.org


> -----Original Message-----
> From: Daniel Shahaf [mailto:dani...@apache.org]
> Sent: zaterdag 24 september 2016 09:11
> To: FEDERICO PRADES ILLANES <federic...@bbva.com>
> Cc: us...@subversion.apache.org
> Subject: Re: svn switch, touches files with svn:keywords
>
> FEDERICO PRADES ILLANES wrote on Fri, Sep 23, 2016 at 12:36:24 +0200:
> > Steps to reproduce:
> >
> > 1. Create a branch b1.
> > 2. Create an dummy file in b1, with svn:keywords.
> > 3. Don't use the svn:keywords on the file.
> > 4. Commit the changes to b1.
> > 5. Create a branch b2, from b1.
> > 6. Perform a switch to b2.
> >
> > Expected results:
> >
> > - Dummy file modification time hasn't change
> >
> > Actual results
> >
> > - Dummy file modification time has change
>
> I can reproduce this with current trunk and I agree it's a (minor) bug.

See also issue #1975, which documented the opposite behavior as a bug, which was fixed in 1.9.0
http://subversion.apache.org/issue1975

Bert

Nico Kadel-Garcia

unread,
Sep 27, 2016, 7:44:18 PM9/27/16
to Daniel Shahaf, Lorenz, Subversion
On Mon, Sep 26, 2016 at 3:36 AM, Daniel Shahaf <d...@daniel.shahaf.name> wrote:
> Lorenz wrote on Mon, Sep 26, 2016 at 06:01:31 +0000:
>> are you sure about tha being a bug?
>>
>> If for instance in the file the URL keyword is used to initialize a
>> string variable, wouldn't you want the file to be recompiled after the
>> switch?
>
> You are describing a different scenario than the OP.
>
> In the OP's scenario, the file content with keywords expanded was the
> same before and after the switch, yet the mtime differed. I consider
> that a bug.

How can Subversion know that? Reprocessing the file, setting aside the
processed file, then doing a "diff" between them is a lot more pain
than it's worth. And the maintenance of supporting such a feature for
all releases, and backporting it to previous Subversion releases to
support such a contorted workflow as switching upstream midrepos or
branches midstream, is potentially quite fragile.

If you switch the upstream repo for a software source repo, recompile.
It's the best way to make sure you've not left some datestamped file
inconsistencies that could mess with the system.

> If the file content with keywords expanded had been different before the
> switch to after to the switch, then yes, I would have expected the mtime
> to differ, too.

And how, exactly, are you going to verify this? Put in a locally
processed working file to check against? That's begging to leave
debris in the working repository./

Branko Čibej

unread,
Sep 27, 2016, 7:59:24 PM9/27/16
to us...@subversion.apache.org
On 28.09.2016 01:44, Nico Kadel-Garcia wrote:
>
>> If the file content with keywords expanded had been different before the
>> switch to after to the switch, then yes, I would have expected the mtime
>> to differ, too.
> And how, exactly, are you going to verify this? Put in a locally
> processed working file to check against? That's begging to leave
> debris in the working repository.

Subversion already has both files available.

Files that arrive in the working copy (during checkout, update, etc.)
are preprocessed in a temporary to expand keywords, adjust newlines and
so on, then moved to the final location in the working copy.

-- Brane

Daniel Shahaf

unread,
Sep 28, 2016, 6:50:12 AM9/28/16
to Nico Kadel-Garcia, Lorenz, Subversion
Nico Kadel-Garcia wrote on Tue, Sep 27, 2016 at 19:44:07 -0400:
> If you switch the upstream repo for a software source repo, recompile.
> It's the best way to make sure you've not left some datestamped file
> inconsistencies that could mess with the system.

Subversion supports both the "recompile from scratch after switch"
workflow and the "recompile minimally after switch" workflow. You don't
have to use the latter if you don't like it.

Daniel

Lorenz

unread,
Sep 29, 2016, 10:33:03 AM9/29/16
to us...@subversion.apache.org
Could you please elaborate a bit on this?

I assume you refere to the "use-commit-times" config option?
--

Lorenz

Daniel Shahaf

unread,
Sep 30, 2016, 3:14:18 AM9/30/16
to Lorenz, us...@subversion.apache.org
I mainly meant that Subversion, as a product, does not enforce either
workflow. We provide «svn cleanup --remove-ignored --remove-unversioned»
to support the latter work-flow, and we don't change mtimes unnecessarily
to support the former workflow. (Hence accepting the OP's report as a bug.)
Reply all
Reply to author
Forward
0 new messages