Git Product home page Git Product logo

Comments (8)

ufUNnxagpM avatar ufUNnxagpM commented on April 16, 2024 2

Not sure if I'll get to coding this, but it can be fixed by replacing the colon in the android folder name with a Modified Letter Colon which is fairly similar to a regular colon. Essentially, as @divVerent said, this could be used to encode it both ways while maintaining the look of the colon on android.

from adb-sync.

zhanghai avatar zhanghai commented on April 16, 2024 1

It's actually a new restriction when using the FUSE backed emulated storage and the code is in MediaProvider:

    public int insertFileIfNecessaryForFuse(@NonNull String path, int uid) {
...
            if (!path.equals(getAbsoluteSanitizedPath(path))) {
                Log.e(TAG, "File name contains invalid characters");
                return OsConstants.EPERM;
            }

Since it's a limitation in the system (and to be fair, colon is indeed an invalid character for a FAT file system), I don't think adb-sync can do anything here.

EDIT:

You can edit PerformCopies and put in dst_name = self.dst[i] + re.sub(b'["*:<>?\\\\|]', b'_', name)

from adb-sync.

marcvs avatar marcvs commented on April 16, 2024 1

This used to work on Android 10 (for me) and I see absolutely no reason why ":" cannot be a valid character on modern filesystems.

from adb-sync.

divVerent avatar divVerent commented on April 16, 2024

I would prefer not introducing any kind of replacing as otherwise syncing back and forth would create duplicates.

If anything we would need either a bijective encoding, or - if activated by a special flag - an injective one (e.g. replacing invalid characters by escapes like =3A for a colon).

from adb-sync.

alecmuffett avatar alecmuffett commented on April 16, 2024

Just to check, has anyone done a root cause analysis on this? Most Unix filesystems have no problem with colon characters (on Mac, maybe, but that's worked around) so I am intrigued by what is causing this?

Edit: good heavens, there are several possible issues here:

    if subprocess.call(
        self.adb +
        [b'shell', b'mkdir -p %s' % (self.QuoteArgument(path),)]) != 0:
      raise OSError('mkdir failed')

from adb-sync.

Venryx avatar Venryx commented on April 16, 2024

For others on Windows who want to still be able to copy the files with invalid characters, this is the workaround I currently use.

Replace the dst_name = self.dst[i] + name line in the PerformCopies function with: dst_name = self.dst[i] + re.sub(b'[^\w\-_\.\(\) \\/]', b'_', name)

If you merely want the files with invalid names to be ignored, see here to have it just skip over files that have errors (you just add a try-catch in the loop): #29 (comment)

from adb-sync.

zhanghai avatar zhanghai commented on April 16, 2024

I'm hit by this as well - and I'm using adb-sync on Linux. The problem seems to be with the underlying adb implementation because I can't adb push files with colon in their names either. This EPERM seems to be a new behavior on Andorid 10 or 11.

from adb-sync.

pschichtel avatar pschichtel commented on April 16, 2024

This is not only caused by colons, but is also by asterisks and double quotes.

from adb-sync.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.