You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by "Cooke, Mark" <ma...@siemens-healthineers.com> on 2019/02/14 13:55:10 UTC

svn cleanup options

Hello list,

Windows 7, using the 1.10.3 command line tools (from TortoiseSVN).

I am trying to use `svn cleanup` in a build script (batch file) to remove some ignored / unversioned files that may have been generated by a previous build.  However, some of them are marked as "read-only" and cleanup stops with an error.


I have a couple of questions:

Is it valid to use both --remove-ignored and --remove-unversioned in the same command?  This is not clear in the help text although it seems to work (until it hits the read-only files).

Is there any way to say "ignore errors" or "ignore read-only" or even "remove read-only"?

Many thanks

~ Mark C


Re: svn cleanup options

Posted by Branko Čibej <br...@apache.org>.
On 15.02.2019 10:23, Cooke, Mark wrote:
>> -----Original Message-----
>> From: Branko Čibej [mailto:brane@apache.org]
>> Sent: Friday, February 15, 2019 7:43 AM
>>
>> On 15.02.2019 08:02, Cooke, Mark wrote:
>>>> -----Original Message-----
>>>> From: Branko Čibej [mailto:brane@apache.org]
>>>> Sent: Thursday, February 14, 2019 3:17 PM
>>>>
>>>> On 14.02.2019 15:33, Stefan Sperling wrote:
>>>>> On Thu, Feb 14, 2019 at 03:29:20PM +0100, Stefan Sperling wrote:
>>>>>> On Thu, Feb 14, 2019 at 01:55:10PM +0000, Cooke, Mark wrote:
>>>>>>> Is there any way to say "ignore errors" or "ignore read-only" or even "remove read-only"?
>>>>>>>
>>>>>> Well, it should already work without errors.
>>>>>> I am not sure why it does not work for you :-/
>>>>> Oh, if I remember correctly, Windows has this odd quirk where it is
>>>>> unable to delete files which are being held open by an application.
>>>>>
>>>>> Is this is happening in your case? If so, you will need to close these
>>>>> files first. This is not Subversion-specific; every program on Windows
>>>>> is affected by this issue.
>>> Sorry Stefan, I did not see your reply.  I have been bitten by that before and I am fairly confident these files
>> are not open.
>>>> That's true but 'open by an application' and 'has read-only flag set'
>>>> are two different things. Still, Subversion's 'make file read/write'
>>>> will clear the Windows read-only flag specifically for this reason.
>>>> Perhaps the read-only files are in some unversioned directory? We might
>>>> have missed this case.
>>>>
>>>> -- Brane
>>> Thanks Brane, you are right, the read-only items are in a sub-folder that is copied in as part of the setup (and
>> then set as read-only).  Some of the run time files are stored outside the source tree and then copied in to the
>> required locations before building the setup executables.
>>> As it happens I am only really bothered about a specific sub-folder, so I have updated the script to clear the
>> read-only flag before running the svn commands.
>>> The issue you have identified is still there but is it worth fixing?
>>
>> Yes, it's worth fixing, because it's a bug. :) If we have the
>> --remove-unversioned option and it happens not to work because we fail
>> to clear the read-only bit on files within unversioned directories,
>> well, we should fix that.
>>
>> Can you file an issue in https://issues.apache.org/jira/projects/SVN please?
>>
>> -- Brane
> Thanks Brane: https://issues.apache.org/jira/browse/SVN-4806


This is now fixed on trunk for 1.12.0, and proposed for the next 1.9.x,
1.10.x and 1.11.x releases.

-- Brane


RE: svn cleanup options

Posted by "Cooke, Mark" <ma...@siemens-healthineers.com>.
> -----Original Message-----
> From: Branko Čibej [mailto:brane@apache.org]
> Sent: Friday, February 15, 2019 7:43 AM
> 
> On 15.02.2019 08:02, Cooke, Mark wrote:
> >> -----Original Message-----
> >> From: Branko Čibej [mailto:brane@apache.org]
> >> Sent: Thursday, February 14, 2019 3:17 PM
> >>
> >> On 14.02.2019 15:33, Stefan Sperling wrote:
> >>> On Thu, Feb 14, 2019 at 03:29:20PM +0100, Stefan Sperling wrote:
> >>>> On Thu, Feb 14, 2019 at 01:55:10PM +0000, Cooke, Mark wrote:
> >>>>> Is there any way to say "ignore errors" or "ignore read-only" or even "remove read-only"?
> >>>>>
> >>>> Well, it should already work without errors.
> >>>> I am not sure why it does not work for you :-/
> >>> Oh, if I remember correctly, Windows has this odd quirk where it is
> >>> unable to delete files which are being held open by an application.
> >>>
> >>> Is this is happening in your case? If so, you will need to close these
> >>> files first. This is not Subversion-specific; every program on Windows
> >>> is affected by this issue.
> > Sorry Stefan, I did not see your reply.  I have been bitten by that before and I am fairly confident these files
> are not open.
> >
> >> That's true but 'open by an application' and 'has read-only flag set'
> >> are two different things. Still, Subversion's 'make file read/write'
> >> will clear the Windows read-only flag specifically for this reason.
> >> Perhaps the read-only files are in some unversioned directory? We might
> >> have missed this case.
> >>
> >> -- Brane
> > Thanks Brane, you are right, the read-only items are in a sub-folder that is copied in as part of the setup (and
> then set as read-only).  Some of the run time files are stored outside the source tree and then copied in to the
> required locations before building the setup executables.
> >
> > As it happens I am only really bothered about a specific sub-folder, so I have updated the script to clear the
> read-only flag before running the svn commands.
> >
> > The issue you have identified is still there but is it worth fixing?
> 
> 
> Yes, it's worth fixing, because it's a bug. :) If we have the
> --remove-unversioned option and it happens not to work because we fail
> to clear the read-only bit on files within unversioned directories,
> well, we should fix that.
> 
> Can you file an issue in https://issues.apache.org/jira/projects/SVN please?
> 
> -- Brane

Thanks Brane: https://issues.apache.org/jira/browse/SVN-4806

~ Mark C


Re: svn cleanup options

Posted by Branko Čibej <br...@apache.org>.
On 15.02.2019 08:02, Cooke, Mark wrote:
>> -----Original Message-----
>> From: Branko Čibej [mailto:brane@apache.org]
>> Sent: Thursday, February 14, 2019 3:17 PM
>>
>> On 14.02.2019 15:33, Stefan Sperling wrote:
>>> On Thu, Feb 14, 2019 at 03:29:20PM +0100, Stefan Sperling wrote:
>>>> On Thu, Feb 14, 2019 at 01:55:10PM +0000, Cooke, Mark wrote:
>>>>> Is there any way to say "ignore errors" or "ignore read-only" or even "remove read-only"?
>>>>>
>>>> Well, it should already work without errors.
>>>> I am not sure why it does not work for you :-/
>>> Oh, if I remember correctly, Windows has this odd quirk where it is
>>> unable to delete files which are being held open by an application.
>>>
>>> Is this is happening in your case? If so, you will need to close these
>>> files first. This is not Subversion-specific; every program on Windows
>>> is affected by this issue.
> Sorry Stefan, I did not see your reply.  I have been bitten by that before and I am fairly confident these files are not open.
>
>> That's true but 'open by an application' and 'has read-only flag set'
>> are two different things. Still, Subversion's 'make file read/write'
>> will clear the Windows read-only flag specifically for this reason.
>> Perhaps the read-only files are in some unversioned directory? We might
>> have missed this case.
>>
>> -- Brane
> Thanks Brane, you are right, the read-only items are in a sub-folder that is copied in as part of the setup (and then set as read-only).  Some of the run time files are stored outside the source tree and then copied in to the required locations before building the setup executables.
>
> As it happens I am only really bothered about a specific sub-folder, so I have updated the script to clear the read-only flag before running the svn commands.
>
> The issue you have identified is still there but is it worth fixing?


Yes, it's worth fixing, because it's a bug. :) If we have the
--remove-unversioned option and it happens not to work because we fail
to clear the read-only bit on files within unversioned directories,
well, we should fix that.

Can you file an issue in https://issues.apache.org/jira/projects/SVN please?

-- Brane


RE: svn cleanup options

Posted by "Cooke, Mark" <ma...@siemens-healthineers.com>.
> -----Original Message-----
> From: Branko Čibej [mailto:brane@apache.org]
> Sent: Thursday, February 14, 2019 3:17 PM
> 
> On 14.02.2019 15:33, Stefan Sperling wrote:
> > On Thu, Feb 14, 2019 at 03:29:20PM +0100, Stefan Sperling wrote:
> >> On Thu, Feb 14, 2019 at 01:55:10PM +0000, Cooke, Mark wrote:
> >>> Is there any way to say "ignore errors" or "ignore read-only" or even "remove read-only"?
> >>>
> >> Well, it should already work without errors.
> >> I am not sure why it does not work for you :-/
> > Oh, if I remember correctly, Windows has this odd quirk where it is
> > unable to delete files which are being held open by an application.
> >
> > Is this is happening in your case? If so, you will need to close these
> > files first. This is not Subversion-specific; every program on Windows
> > is affected by this issue.

Sorry Stefan, I did not see your reply.  I have been bitten by that before and I am fairly confident these files are not open.

> That's true but 'open by an application' and 'has read-only flag set'
> are two different things. Still, Subversion's 'make file read/write'
> will clear the Windows read-only flag specifically for this reason.
> Perhaps the read-only files are in some unversioned directory? We might
> have missed this case.
> 
> -- Brane

Thanks Brane, you are right, the read-only items are in a sub-folder that is copied in as part of the setup (and then set as read-only).  Some of the run time files are stored outside the source tree and then copied in to the required locations before building the setup executables.

As it happens I am only really bothered about a specific sub-folder, so I have updated the script to clear the read-only flag before running the svn commands.

The issue you have identified is still there but is it worth fixing?

~ Mark C


Re: svn cleanup options

Posted by Branko Čibej <br...@apache.org>.
On 14.02.2019 15:33, Stefan Sperling wrote:
> On Thu, Feb 14, 2019 at 03:29:20PM +0100, Stefan Sperling wrote:
>> On Thu, Feb 14, 2019 at 01:55:10PM +0000, Cooke, Mark wrote:
>>> Is there any way to say "ignore errors" or "ignore read-only" or even "remove read-only"?
>>>
>> Well, it should already work without errors.
>> I am not sure why it does not work for you :-/
> Oh, if I remember correctly, Windows has this odd quirk where it is
> unable to delete files which are being held open by an application.
>
> Is this is happening in your case? If so, you will need to close these
> files first. This is not Subversion-specific; every program on Windows
> is affected by this issue.


That's true but 'open by an application' and 'has read-only flag set'
are two different things. Still, Subversion's 'make file read/write'
will clear the Windows read-only flag specifically for this reason.
Perhaps the read-only files are in some unversioned directory? We might
have missed this case.

-- Brane

Re: svn cleanup options

Posted by Stefan Sperling <st...@elego.de>.
On Thu, Feb 14, 2019 at 03:29:20PM +0100, Stefan Sperling wrote:
> On Thu, Feb 14, 2019 at 01:55:10PM +0000, Cooke, Mark wrote:
> > Is there any way to say "ignore errors" or "ignore read-only" or even "remove read-only"?
> > 
> 
> Well, it should already work without errors.
> I am not sure why it does not work for you :-/

Oh, if I remember correctly, Windows has this odd quirk where it is
unable to delete files which are being held open by an application.

Is this is happening in your case? If so, you will need to close these
files first. This is not Subversion-specific; every program on Windows
is affected by this issue.

Re: svn cleanup options

Posted by Stefan Sperling <st...@elego.de>.
On Thu, Feb 14, 2019 at 01:55:10PM +0000, Cooke, Mark wrote:
> Hello list,
> 
> Windows 7, using the 1.10.3 command line tools (from TortoiseSVN).
> 
> I am trying to use `svn cleanup` in a build script (batch file) to remove some ignored / unversioned files that may have been generated by a previous build.  However, some of them are marked as "read-only" and cleanup stops with an error.
> 
> 

Which error message and code are you seeing exactly?

The cleanup code calls a functions which is supposed to remove
files even if they don't have write-permissions, and even on Windows.
It looks like in your case this is going wrong for some reason.

On Unix, it is working as expected for me:

$ touch foo
$ chmod 444 foo
$ svn st
?       foo
$ svn cleanup --remove-unversioned
D         foo
$ svn st
$

I don't have a Windows machine.

> I have a couple of questions:
> 
> Is it valid to use both --remove-ignored and --remove-unversioned in the same command?  This is not clear in the help text although it seems to work (until it hits the read-only files).

Yes, passing both flags at the same time is valid.

> Is there any way to say "ignore errors" or "ignore read-only" or even "remove read-only"?
> 

Well, it should already work without errors.
I am not sure why it does not work for you :-/

Regards,
Stefan