public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* Accessing long filesystem paths using Python
       [not found] <AM6PR08MB4421EE65314E815E8BA73753E63B9@AM6PR08MB4421.eurprd08.prod.outlook.com>
@ 2022-11-04 12:15 ` Fritjof Bornebusch
  2022-11-04 12:56   ` marco atzeri
  0 siblings, 1 reply; 4+ messages in thread
From: Fritjof Bornebusch @ 2022-11-04 12:15 UTC (permalink / raw)
  To: cygwin

[-- Attachment #1: Type: text/plain, Size: 407 bytes --]

Hi,

I need to write files whose path exceed the maximum value of 260 characters.
Using Windows paths, you can add \\?\ as prefix, e.g., \\?\C:\Users\foo\bar\<file://%3f/C:/Users/foo/bar/>....

However, it seems like this is not the case in Cygwin. When I use \\?\/home/foo/bar<file://%3f/home/foo/bar>, I get no file pointer back.

Does someone have a clue how I can bypass this?

Best,
Fritjof

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

* Re: Accessing long filesystem paths using Python
  2022-11-04 12:15 ` Accessing long filesystem paths using Python Fritjof Bornebusch
@ 2022-11-04 12:56   ` marco atzeri
  2022-11-04 13:30     ` Fritjof Bornebusch
  0 siblings, 1 reply; 4+ messages in thread
From: marco atzeri @ 2022-11-04 12:56 UTC (permalink / raw)
  To: Fritjof Bornebusch; +Cc: cygwin

On Fri, Nov 4, 2022 at 1:16 PM Fritjof Bornebusch
<fritjof.bornebusch@prover.com> wrote:
>
> Hi,
>
> I need to write files whose path exceed the maximum value of 260 characters.
> Using Windows paths, you can add \\?\ as prefix, e.g., \\?\C:\Users\foo\bar\<file://%3f/C:/Users/foo/bar/>....
>
> However, it seems like this is not the case in Cygwin. When I use \\?\/home/foo/bar<file://%3f/home/foo/bar>, I get no file pointer back.
>
> Does someone have a clue how I can bypass this?
>
> Best,
> Fritjof
>

Have you tried POSIX style ?
/cygdrive/C/Users/foo/bar..

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

* RE: Accessing long filesystem paths using Python
  2022-11-04 12:56   ` marco atzeri
@ 2022-11-04 13:30     ` Fritjof Bornebusch
  2022-11-07  9:33       ` Corinna Vinschen
  0 siblings, 1 reply; 4+ messages in thread
From: Fritjof Bornebusch @ 2022-11-04 13:30 UTC (permalink / raw)
  To: marco atzeri; +Cc: cygwin

Jep,

No success.

-----Original Message-----
From: marco atzeri <marco.atzeri@gmail.com> 
Sent: Friday, 4 November 2022 13:57
To: Fritjof Bornebusch <fritjof.bornebusch@prover.com>
Cc: cygwin@cygwin.com
Subject: Re: Accessing long filesystem paths using Python

On Fri, Nov 4, 2022 at 1:16 PM Fritjof Bornebusch <fritjof.bornebusch@prover.com> wrote:
>
> Hi,
>
> I need to write files whose path exceed the maximum value of 260 characters.
> Using Windows paths, you can add \\?\ as prefix, e.g., \\?\C:\Users\foo\bar\<file://%3f/C:/Users/foo/bar/>....
>
> However, it seems like this is not the case in Cygwin. When I use \\?\/home/foo/bar<file://%3f/home/foo/bar>, I get no file pointer back.
>
> Does someone have a clue how I can bypass this?
>
> Best,
> Fritjof
>

Have you tried POSIX style ?
/cygdrive/C/Users/foo/bar..

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

* Re: Accessing long filesystem paths using Python
  2022-11-04 13:30     ` Fritjof Bornebusch
@ 2022-11-07  9:33       ` Corinna Vinschen
  0 siblings, 0 replies; 4+ messages in thread
From: Corinna Vinschen @ 2022-11-07  9:33 UTC (permalink / raw)
  To: cygwin

Hi Fridjof,

Please don't top-post.

On Nov  4 13:30, Fritjof Bornebusch wrote:
> On Nov  4 13:57, marco atzeri wrote:
>> On Fri, Nov 4, 2022 at 1:16 PM Fritjof Bornebusch wrote:
>> >
>> > Hi,
>> >
>> > I need to write files whose path exceed the maximum value of 260 characters.
>> > Using Windows paths, you can add \\?\ as prefix, e.g., \\?\C:\Users\foo\bar\<file://%3f/C:/Users/foo/bar/>....
>> >
>> > However, it seems like this is not the case in Cygwin. When I use \\?\/home/foo/bar<file://%3f/home/foo/bar>, I get no file pointer back.
>> >
>> > Does someone have a clue how I can bypass this?
>> >
>> > Best,
>> > Fritjof
>> >
>> 
>> Have you tried POSIX style ?
>> /cygdrive/C/Users/foo/bar..
> 
> Jep,
> 
> No success.

Works for me:

======================================================================
$ cat > longp.sh <<EOF
#!/bin/bash

POSIX_MAX=4096
# 240 chars per path component
DIRNAM="123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890"

LPATH=/tmp
cd /tmp

while [ $(echo -n "$LPATH" | wc -c) -lt $POSIX_MAX ]
do
  mkdir "$DIRNAM" || exit 1
  LPATH="$LPATH/$DIRNAM"
  ls -d "$LPATH" || exit 2
  cd "$LPATH" || exit 3
  echo "Current length: $(echo -n $LPATH | wc -c)"
  sleep 1
done
EOF
$ chmod +x longp.sh
$ ./longp.sh
/tmp/123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
Current length: 245
[...]
12345678901234567890/123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
Current length: 4101
$
======================================================================

If you have specific trouble, please provide a specific, simple testcase,
preferredly in plain C or as shell script.


Thanks,
Corinna

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

end of thread, other threads:[~2022-11-07  9:33 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <AM6PR08MB4421EE65314E815E8BA73753E63B9@AM6PR08MB4421.eurprd08.prod.outlook.com>
2022-11-04 12:15 ` Accessing long filesystem paths using Python Fritjof Bornebusch
2022-11-04 12:56   ` marco atzeri
2022-11-04 13:30     ` Fritjof Bornebusch
2022-11-07  9:33       ` Corinna Vinschen

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).