Can't deal with files with U+1F308 RAINBOW in their name

classic Classic list List threaded Threaded
12 messages Options
Reply | Threaded
Open this post in threaded view
|

Can't deal with files with U+1F308 RAINBOW in their name

積丹尼 Dan Jacobson
If I am in dired,

/adb::/sdcard/GTs/gpx:
  total 7674
  drwxrwx--x  1 root sdcard_rw    4096 2019-10-28  .
  drwxrwx--x  1 root sdcard_rw    4096 2018-05-16  ..
  -rw-rw----  1 root sdcard_rw   17132 2019-10-21  2019-10-14_05-52-10.gpx
  -rw-rw----  1 root sdcard_rw    8493 2019-11-02  2019-10-14_09-05-25.gpx
  -rw-rw----  1 root sdcard_rw 7578327 2019-09-26  village_excel.xls
  -rw-rw----  1 root sdcard_rw     488 2019-10-28  🌈.gpx

and I hit v (runs the command dired-view-file), on that final file, I get
dired-get-file-for-visit: File no longer exists; type ‘g’ to update Dired buffer

OK, I have to first do
$ adb pull /sdcard/GTs/gpx/🌈.gpx /tmp/
/sdcard/GTs/gpx/🌈.gpx: 1 file pulled. 0.0 MB/s (488 bytes in 0.018s)

and view it locally. (Can't copy from dired of course either.)

tramp-version "2.4.2"

Reply | Threaded
Open this post in threaded view
|

Re: Can't deal with files with U+1F308 RAINBOW in their name

Michael Albinus
積丹尼 Dan Jacobson <[hidden email]> writes:

Hi Dan,

> If I am in dired,
>
> /adb::/sdcard/GTs/gpx:
>   total 7674
>   drwxrwx--x  1 root sdcard_rw    4096 2019-10-28  .
>   drwxrwx--x  1 root sdcard_rw    4096 2018-05-16  ..
>   -rw-rw----  1 root sdcard_rw   17132 2019-10-21  2019-10-14_05-52-10.gpx
>   -rw-rw----  1 root sdcard_rw    8493 2019-11-02  2019-10-14_09-05-25.gpx
>   -rw-rw----  1 root sdcard_rw 7578327 2019-09-26  village_excel.xls
>   -rw-rw----  1 root sdcard_rw     488 2019-10-28  🌈.gpx
>
> and I hit v (runs the command dired-view-file), on that final file, I get
> dired-get-file-for-visit: File no longer exists; type ‘g’ to update Dired buffer
>
> OK, I have to first do
> $ adb pull /sdcard/GTs/gpx/🌈.gpx /tmp/
> /sdcard/GTs/gpx/🌈.gpx: 1 file pulled. 0.0 MB/s (488 bytes in 0.018s)
>
> and view it locally. (Can't copy from dired of course either.)

I can confirm this. adb pull and adb push work as expected. But for
other file operations, I need adb shell. And this doesn't seem to be
capable to handle multibyte characters above U+10000. Sorry for that.

Best regards, Michael.

Reply | Threaded
Open this post in threaded view
|

Re: Can't deal with files with U+1F308 RAINBOW in their name

yary-2
積丹尼 Dan Jacobson, since "adb shell ... doesn't seem to be capable to
handle multibyte characters above U+10000" – can you open the adb
shell and see if "ls" mis-handles the rainbow char? If so then you
have a test case that you can file directly with the Android Debug
Bridge people- though I don't know who they are...

-y

-y


On Wed, Jul 8, 2020 at 8:48 AM Michael Albinus <[hidden email]> wrote:

>
> 積丹尼 Dan Jacobson <[hidden email]> writes:
>
> Hi Dan,
>
> > If I am in dired,
> >
> > /adb::/sdcard/GTs/gpx:
> >   total 7674
> >   drwxrwx--x  1 root sdcard_rw    4096 2019-10-28  .
> >   drwxrwx--x  1 root sdcard_rw    4096 2018-05-16  ..
> >   -rw-rw----  1 root sdcard_rw   17132 2019-10-21  2019-10-14_05-52-10.gpx
> >   -rw-rw----  1 root sdcard_rw    8493 2019-11-02  2019-10-14_09-05-25.gpx
> >   -rw-rw----  1 root sdcard_rw 7578327 2019-09-26  village_excel.xls
> >   -rw-rw----  1 root sdcard_rw     488 2019-10-28  .gpx
> >
> > and I hit v (runs the command dired-view-file), on that final file, I get
> > dired-get-file-for-visit: File no longer exists; type ‘g’ to update Dired buffer
> >
> > OK, I have to first do
> > $ adb pull /sdcard/GTs/gpx/.gpx /tmp/
> > /sdcard/GTs/gpx/.gpx: 1 file pulled. 0.0 MB/s (488 bytes in 0.018s)
> >
> > and view it locally. (Can't copy from dired of course either.)
>
> I can confirm this. adb pull and adb push work as expected. But for
> other file operations, I need adb shell. And this doesn't seem to be
> capable to handle multibyte characters above U+10000. Sorry for that.
>
> Best regards, Michael.
>

Reply | Threaded
Open this post in threaded view
|

Re: Can't deal with files with U+1F308 RAINBOW in their name

積丹尼 Dan Jacobson
>> But for other file operations, I need adb shell. And this doesn't seem to be
>> capable to handle multibyte characters above U+10000. Sorry for that.

I'm not sure if he is saying if it is adb shell's bug or Tramps.
I only connect my cell phone once every two months.

Reply | Threaded
Open this post in threaded view
|

Re: Can't deal with files with U+1F308 RAINBOW in their name

Michael Albinus
In reply to this post by yary-2
yary <[hidden email]> writes:

> since "adb shell ... doesn't seem to be capable to
> handle multibyte characters above U+10000" – can you open the adb
> shell and see if "ls" mis-handles the rainbow char? If so then you
> have a test case that you can file directly with the Android Debug
> Bridge people- though I don't know who they are...

The ls command outputs the char properly:

--8<---------------cut here---------------start------------->8---
zeroflte:/ $ ls /sdcard/tmp/
123.org              crypt                🌈.gpx            
zeroflte:/ $
--8<---------------cut here---------------end--------------->8---

However, I have no idea how to quote the filename "🌈.gpx" in the
shell's commands like ls. And a Google search didn't gave me any clue.

> -y

Best regards, Michael.

Reply | Threaded
Open this post in threaded view
|

Re: Can't deal with files with U+1F308 RAINBOW in their name

積丹尼 Dan Jacobson
MA> However, I have no idea how to quote the filename "🌈.gpx" in the
MA> shell's commands like ls. And a Google search didn't gave me any clue.

Maybe:
$ man ls
       -Q, --quote-name
              enclose entry names in double quotes

       --quoting-style=WORD
              use  quoting  style  WORD  for  entry  names:  literal,  locale, shell, shell-always, shell-escape,
              shell-escape-always, c, escape (overrides QUOTING_STYLE environment variable)

Oh, maybe the ls that adb uses doesn't have it.

Reply | Threaded
Open this post in threaded view
|

Re: Can't deal with files with U+1F308 RAINBOW in their name

Michael Albinus
積丹尼 Dan Jacobson <[hidden email]> writes:

> Maybe:
> $ man ls
>        -Q, --quote-name
>               enclose entry names in double quotes
>
>        --quoting-style=WORD
>               use  quoting  style  WORD  for  entry  names:  literal,  locale, shell, shell-always, shell-escape,
>               shell-escape-always, c, escape (overrides QUOTING_STYLE environment variable)

That's what I use in POSIX shells under GNU/Linux.

> Oh, maybe the ls that adb uses doesn't have it.

No, that's not applicable in toybox, the shell used in Android.

Best regards, Michael.

Reply | Threaded
Open this post in threaded view
|

Re: Can't deal with files with U+1F308 RAINBOW in their name

積丹尼 Dan Jacobson
How about
$ man find|col -b|grep -A 77 '^UNUSUAL FILENAMES'
UNUSUAL FILENAMES
       Many of the actions of find result in the printing of data which is u...

Reply | Threaded
Open this post in threaded view
|

Re: Can't deal with files with U+1F308 RAINBOW in their name

Michael Albinus
yary <[hidden email]> writes:

> Toybox's "ls" manpage is at https://landley.net/toybox/help.html#ls
> for what it's worth

Thanks. The "-b" option looks promising. Unfortunately, it doesn't exist
on my Galaxy S6 running Android 7.0.

> -y

Best regards, Michael.

Reply | Threaded
Open this post in threaded view
|

Re: Can't deal with files with U+1F308 RAINBOW in their name

Michael Albinus
In reply to this post by 積丹尼 Dan Jacobson
積丹尼 Dan Jacobson <[hidden email]> writes:

Hi Dan,

> How about
> $ man find|col -b|grep -A 77 '^UNUSUAL FILENAMES'
> UNUSUAL FILENAMES
>        Many of the actions of find result in the printing of data which is u...

Thanks. However, `find` on my Galaxy S6 doesn't know the options:

--8<---------------cut here---------------start------------->8---
1|zeroflte:/ $ find /sdcard/tmp/ -ls                                        
find: bad arg '-ls'
1|zeroflte:/ $
--8<---------------cut here---------------end--------------->8---

Best regards, Michael.

Reply | Threaded
Open this post in threaded view
|

Re: Can't deal with files with U+1F308 RAINBOW in their name

積丹尼 Dan Jacobson
Well, maybe adb, with its powerful backup and pull commands,
needs to have a file listing command, (made from components used in its
backup command), e.g., for the case of a phone with no ls command.

If this is the case maybe you folks should tell the Android people.

I don't suppose Tramp should push its own toybox ls command and then run that...

Reply | Threaded
Open this post in threaded view
|

Re: Can't deal with files with U+1F308 RAINBOW in their name

Michael Albinus
積丹尼 Dan Jacobson <[hidden email]> writes:

Hi Dan,

> Well, maybe adb, with its powerful backup and pull commands,
> needs to have a file listing command, (made from components used in its
> backup command), e.g., for the case of a phone with no ls command.
>
> If this is the case maybe you folks should tell the Android people.
>
> I don't suppose Tramp should push its own toybox ls command and then run that...

I have asked on SX:
<https://android.stackexchange.com/questions/226638/how-to-use-multibyte-file-names-in-adb-shell>. Maybe
there will be an answer.

Furthermore, if using the adb shell not interactively, but from my GNU/Linux
shell, it seems to work:

--8<---------------cut here---------------start------------->8---
$ adb shell ls -1 -d -l /sdcard/tmp/\U+1F308.gpx
-rw-rw---- 1 root sdcard_rw 9 2020-07-08 13:26 /sdcard/tmp/🌈.gpx
--8<---------------cut here---------------end--------------->8---

Maybe I can write something around this.

Best regards, Michael.