public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* Could rm remove files and folders with colon in their name?
@ 2021-11-10  9:45 Mario Emmenlauer
  2021-11-10 13:49 ` Corinna Vinschen
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Mario Emmenlauer @ 2021-11-10  9:45 UTC (permalink / raw)
  To: cygwin


Dear All,

I've searched if this topic has come up before but could not find it.

Could 'rm' support removing files and folders that have a colon ':' in
their name? I.e. I would like that 'rm -fr' would remove a full directory
tree, including such folders. Currently it will correctly remove anything
inside such folders, but not the folder itself.

As an example, for the following structure:
     C:/root/folder/C:/inside/file.txt

When using 'rm -fr root', afterwards I have:
     C:/root/folder/C:

To remove everything, I can use 'find root -depth -exec rmdir \{\} \;'

I understand that files and folders with colon in their name are illegal
on Windows and not supported very well. But a number of tools manage to
create (and also remove) such files. I've found that even the native
'del' can support this when using the UNC name (see for example
https://serverfault.com/a/96833). It would be great if Cygwin could
also feature this support.

All the best,

     Mario


PS: These folders are created when I use the Cygwin-based build system
for ICU (see https://unicode-org.github.io/icu/userguide/icu4c/build.html#how-to-build-and-install-on-windows-with-cygwin)
For me this is in a combination with native Perl for Windows (ActivePerl,
in my case), and using absolute build paths. After using ICU's build
system, I can not remove the build tree anymore. It may be possible to
solve this on the ICU side too. But their automake-and-Perl-based path
mangling is not easily modified, and I've failed to isolate the root
cause of the illegal paths.


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Could rm remove files and folders with colon in their name?
  2021-11-10  9:45 Could rm remove files and folders with colon in their name? Mario Emmenlauer
@ 2021-11-10 13:49 ` Corinna Vinschen
  2021-11-10 20:24   ` Mario Emmenlauer
  2021-11-10 14:49 ` Andrey Repin
  2021-11-10 16:35 ` Brian Inglis
  2 siblings, 1 reply; 9+ messages in thread
From: Corinna Vinschen @ 2021-11-10 13:49 UTC (permalink / raw)
  To: cygwin

On Nov 10 10:45, Mario Emmenlauer wrote:
> 
> Dear All,
> 
> I've searched if this topic has come up before but could not find it.
> 
> Could 'rm' support removing files and folders that have a colon ':' in
> their name? I.e. I would like that 'rm -fr' would remove a full directory
> tree, including such folders. Currently it will correctly remove anything
> inside such folders, but not the folder itself.
> 
> As an example, for the following structure:
>     C:/root/folder/C:/inside/file.txt
> 
> When using 'rm -fr root', afterwards I have:
>     C:/root/folder/C:

It works fine if the folder is called, say, "a:b", it just doesn't
work for a name which looks like a drive letter "x:", apparently.

Funny.  I'm busy with non-Cygwin stuff ATM, but I'll look into it
later.

Thanks for the report.


Corinna

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Could rm remove files and folders with colon in their name?
  2021-11-10  9:45 Could rm remove files and folders with colon in their name? Mario Emmenlauer
  2021-11-10 13:49 ` Corinna Vinschen
@ 2021-11-10 14:49 ` Andrey Repin
  2021-11-10 16:35 ` Brian Inglis
  2 siblings, 0 replies; 9+ messages in thread
From: Andrey Repin @ 2021-11-10 14:49 UTC (permalink / raw)
  To: Mario Emmenlauer, cygwin

Greetings, Mario Emmenlauer!


> Dear All,

> I've searched if this topic has come up before but could not find it.

> Could 'rm' support removing files and folders that have a colon ':' in
> their name? I.e. I would like that 'rm -fr' would remove a full directory
> tree, including such folders. Currently it will correctly remove anything
> inside such folders, but not the folder itself.

> As an example, for the following structure:
>      C:/root/folder/C:/inside/file.txt

> When using 'rm -fr root', afterwards I have:
>      C:/root/folder/C:

> To remove everything, I can use 'find root -depth -exec rmdir \{\} \;'

> I understand that files and folders with colon in their name are illegal
> on Windows and not supported very well.

They are not necessarily illegal, it's just not well supported.

> But a number of tools manage to create (and also remove) such files. I've
> found that even the native 'del' can support this when using the UNC name
> (see for example https://serverfault.com/a/96833). It would be great if
> Cygwin could also feature this support.

> PS: These folders are created when I use the Cygwin-based build system
> for ICU (see
> https://unicode-org.github.io/icu/userguide/icu4c/build.html#how-to-build-and-install-on-windows-with-cygwin)
> For me this is in a combination with native Perl for Windows (ActivePerl,
> in my case), and using absolute build paths. After using ICU's build
> system, I can not remove the build tree anymore. It may be possible to
> solve this on the ICU side too. But their automake-and-Perl-based path
> mangling is not easily modified, and I've failed to isolate the root
> cause of the illegal paths.

Mixing Cygwin and native tools like that is prone to cause issues. In your
case, it may be more than one issue, as build system could misdetect the
platform it is building on, and such unusable paths could be the least of your
issues.


-- 
With best regards,
Andrey Repin
Wednesday, November 10, 2021 17:45:57

Sorry for my terrible english...


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Could rm remove files and folders with colon in their name?
  2021-11-10  9:45 Could rm remove files and folders with colon in their name? Mario Emmenlauer
  2021-11-10 13:49 ` Corinna Vinschen
  2021-11-10 14:49 ` Andrey Repin
@ 2021-11-10 16:35 ` Brian Inglis
  2021-11-10 20:23   ` Mario Emmenlauer
  2 siblings, 1 reply; 9+ messages in thread
From: Brian Inglis @ 2021-11-10 16:35 UTC (permalink / raw)
  To: cygwin

On 2021-11-10 02:45, Mario Emmenlauer wrote:
> 
> Dear All,
> 
> I've searched if this topic has come up before but could not find it.
> 
> Could 'rm' support removing files and folders that have a colon ':' in
> their name? I.e. I would like that 'rm -fr' would remove a full directory
> tree, including such folders. Currently it will correctly remove anything
> inside such folders, but not the folder itself.
> 
> As an example, for the following structure:
>      C:/root/folder/C:/inside/file.txt
> 
> When using 'rm -fr root', afterwards I have:
>      C:/root/folder/C:
> 
> To remove everything, I can use 'find root -depth -exec rmdir \{\} \;'
> 
> I understand that files and folders with colon in their name are illegal
> on Windows and not supported very well. But a number of tools manage to
> create (and also remove) such files. I've found that even the native
> 'del' can support this when using the UNC name (see for example
> https://serverfault.com/a/96833). It would be great if Cygwin could
> also feature this support.

> PS: These folders are created when I use the Cygwin-based build system
> for ICU (see 
> https://unicode-org.github.io/icu/userguide/icu4c/build.html#how-to-build-and-install-on-windows-with-cygwin) 
> 
> For me this is in a combination with native Perl for Windows (ActivePerl,
> in my case), and using absolute build paths. After using ICU's build
> system, I can not remove the build tree anymore. It may be possible to
> solve this on the ICU side too. But their automake-and-Perl-based path
> mangling is not easily modified, and I've failed to isolate the root
> cause of the illegal paths.

Install the Cygwin cygport and libicu-devel source and binary packages 
and use only Cygwin exclusively with cygport to avoid problems.

-- 
Take care. Thanks, Brian Inglis, Calgary, Alberta, Canada

This email may be disturbing to some readers as it contains
too much technical detail. Reader discretion is advised.
[Data in binary units and prefixes, physical quantities in SI.]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Could rm remove files and folders with colon in their name?
  2021-11-10 16:35 ` Brian Inglis
@ 2021-11-10 20:23   ` Mario Emmenlauer
  0 siblings, 0 replies; 9+ messages in thread
From: Mario Emmenlauer @ 2021-11-10 20:23 UTC (permalink / raw)
  To: cygwin, Brian Inglis


Hi Brian,

On 10.11.21 17:35, Brian Inglis wrote:
> On 2021-11-10 02:45, Mario Emmenlauer wrote:
>> PS: These folders are created when I use the Cygwin-based build system
>> for ICU (see https://unicode-org.github.io/icu/userguide/icu4c/build.html#how-to-build-and-install-on-windows-with-cygwin)
>> For me this is in a combination with native Perl for Windows (ActivePerl,
>> in my case), and using absolute build paths. After using ICU's build
>> system, I can not remove the build tree anymore. It may be possible to
>> solve this on the ICU side too. But their automake-and-Perl-based path
>> mangling is not easily modified, and I've failed to isolate the root
>> cause of the illegal paths.
> 
> Install the Cygwin cygport and libicu-devel source and binary packages and use only Cygwin exclusively with cygport to avoid problems.


I'm not sure that this is what I want. I want to build ICU with Visual
Studio and the ClangCl compiler frontend from LLVM 13.0.0. Their build
system can use Cygwin for this combination to orchestrate and configure
the build - which I very much like :-)

Sorry that I did not mention this in my email.

The build works fine and I get native ICU shared libraries like I want.
The only "downside" is that it creates the unsupported folders :-)

Cheers,

    Mario


--
BioDataAnalysis GmbH, Mario Emmenlauer      Tel. Buero: +49-89-74677203
Balanstr. 43                   mailto: memmenlauer * biodataanalysis.de
D-81669 München                          http://www.biodataanalysis.de/

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Could rm remove files and folders with colon in their name?
  2021-11-10 13:49 ` Corinna Vinschen
@ 2021-11-10 20:24   ` Mario Emmenlauer
  2021-11-10 20:39     ` Corinna Vinschen
  0 siblings, 1 reply; 9+ messages in thread
From: Mario Emmenlauer @ 2021-11-10 20:24 UTC (permalink / raw)
  To: cygwin

On 10.11.21 14:49, Corinna Vinschen via Cygwin wrote:
> On Nov 10 10:45, Mario Emmenlauer wrote:
>> Could 'rm' support removing files and folders that have a colon ':' in
>> their name? I.e. I would like that 'rm -fr' would remove a full directory
>> tree, including such folders. Currently it will correctly remove anything
>> inside such folders, but not the folder itself.
>>
>> As an example, for the following structure:
>>     C:/root/folder/C:/inside/file.txt
>>
>> When using 'rm -fr root', afterwards I have:
>>     C:/root/folder/C:
> 
> It works fine if the folder is called, say, "a:b", it just doesn't
> work for a name which looks like a drive letter "x:", apparently.

That is indeed interesting, I was not aware of it! Then maybe the
problem is not so hard to solve? That would be awesome!


> Funny.  I'm busy with non-Cygwin stuff ATM, but I'll look into it
> later.
> 
> Thanks for the report.

Thanks a lot for your support!

All the best,

    Mario Emmenlauer


--
BioDataAnalysis GmbH, Mario Emmenlauer      Tel. Buero: +49-89-74677203
Balanstr. 43                   mailto: memmenlauer * biodataanalysis.de
D-81669 München                          http://www.biodataanalysis.de/

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Could rm remove files and folders with colon in their name?
  2021-11-10 20:24   ` Mario Emmenlauer
@ 2021-11-10 20:39     ` Corinna Vinschen
  2021-11-11 14:00       ` Mario Emmenlauer
  2021-11-24 15:40       ` Chris Wagner
  0 siblings, 2 replies; 9+ messages in thread
From: Corinna Vinschen @ 2021-11-10 20:39 UTC (permalink / raw)
  To: cygwin

On Nov 10 21:24, Mario Emmenlauer wrote:
> On 10.11.21 14:49, Corinna Vinschen via Cygwin wrote:
> > On Nov 10 10:45, Mario Emmenlauer wrote:
> >> Could 'rm' support removing files and folders that have a colon ':' in
> >> their name? I.e. I would like that 'rm -fr' would remove a full directory
> >> tree, including such folders. Currently it will correctly remove anything
> >> inside such folders, but not the folder itself.
> >>
> >> As an example, for the following structure:
> >>     C:/root/folder/C:/inside/file.txt
> >>
> >> When using 'rm -fr root', afterwards I have:
> >>     C:/root/folder/C:
> > 
> > It works fine if the folder is called, say, "a:b", it just doesn't
> > work for a name which looks like a drive letter "x:", apparently.
> 
> That is indeed interesting, I was not aware of it! Then maybe the
> problem is not so hard to solve? That would be awesome!

To the contrary.  The problem is the ambiguity that "X:/foo" might
be either the absolute POSIX path $CWD/X:/foo, or the absolute DOS
path "X:\foo".  I have a patch which fixes your case, but not much
else.  The problem is that we historically allow DOS paths as input
at all.  That was a bad decision from the start, but you can't easily
change 25 years of history...


Corinna

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Could rm remove files and folders with colon in their name?
  2021-11-10 20:39     ` Corinna Vinschen
@ 2021-11-11 14:00       ` Mario Emmenlauer
  2021-11-24 15:40       ` Chris Wagner
  1 sibling, 0 replies; 9+ messages in thread
From: Mario Emmenlauer @ 2021-11-11 14:00 UTC (permalink / raw)
  To: cygwin

On 10/11/2021 21:39, Corinna Vinschen via Cygwin wrote:
> On Nov 10 21:24, Mario Emmenlauer wrote:
>> On 10.11.21 14:49, Corinna Vinschen via Cygwin wrote:
>>> On Nov 10 10:45, Mario Emmenlauer wrote:
>>>> Could 'rm' support removing files and folders that have a colon ':' in
>>>> their name? I.e. I would like that 'rm -fr' would remove a full directory
>>>> tree, including such folders. Currently it will correctly remove anything
>>>> inside such folders, but not the folder itself.
>>>>
>>>> As an example, for the following structure:
>>>>      C:/root/folder/C:/inside/file.txt
>>>>
>>>> When using 'rm -fr root', afterwards I have:
>>>>      C:/root/folder/C:
>>>
>>> It works fine if the folder is called, say, "a:b", it just doesn't
>>> work for a name which looks like a drive letter "x:", apparently.
>>
>> That is indeed interesting, I was not aware of it! Then maybe the
>> problem is not so hard to solve? That would be awesome!
> 
> To the contrary.  The problem is the ambiguity that "X:/foo" might
> be either the absolute POSIX path $CWD/X:/foo, or the absolute DOS
> path "X:\foo".  I have a patch which fixes your case, but not much
> else.  The problem is that we historically allow DOS paths as input
> at all.  That was a bad decision from the start, but you can't easily
> change 25 years of history...

Oh my, I see! All the more thanks for so quickly patching support for
this use case. Its highly appreciated!

All the best,

     Mario


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Could rm remove files and folders with colon in their name?
  2021-11-10 20:39     ` Corinna Vinschen
  2021-11-11 14:00       ` Mario Emmenlauer
@ 2021-11-24 15:40       ` Chris Wagner
  1 sibling, 0 replies; 9+ messages in thread
From: Chris Wagner @ 2021-11-24 15:40 UTC (permalink / raw)
  To: cygwin

On 2021-11-10 3:39 pm, Corinna Vinschen via Cygwin wrote:
> To the contrary.  The problem is the ambiguity that "X:/foo" might
> be either the absolute POSIX path $CWD/X:/foo, or the absolute DOS
> path "X:\foo".  I have a patch which fixes your case, but not much
> else.  The problem is that we historically allow DOS paths as input
> at all.  That was a bad decision from the start, but you can't easily
> change 25 years of history...

To contribute my 2 cents, native support for DOS paths is invaluable for 
me.  Changeing that would break a lot of Windows/POSIX integration.

The simple fix for all weird/ambiguous names is to qualify it with 
`./...`.

Thanks.

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2021-11-24 15:40 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-10  9:45 Could rm remove files and folders with colon in their name? Mario Emmenlauer
2021-11-10 13:49 ` Corinna Vinschen
2021-11-10 20:24   ` Mario Emmenlauer
2021-11-10 20:39     ` Corinna Vinschen
2021-11-11 14:00       ` Mario Emmenlauer
2021-11-24 15:40       ` Chris Wagner
2021-11-10 14:49 ` Andrey Repin
2021-11-10 16:35 ` Brian Inglis
2021-11-10 20:23   ` Mario Emmenlauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).