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 · 18 comments

Comments

Projects
None yet
7 participants
@Whirlwind
Copy link
Contributor

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

This comment has been minimized.

Copy link
Contributor Author

commented May 6, 2018

@segiddins

This comment has been minimized.

Copy link
Member

commented May 6, 2018

Looks like potentially an encoding issue

@Whirlwind

This comment has been minimized.

Copy link
Contributor Author

commented May 7, 2018

I try change the encoding:

export LC_CTYPE=C

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

@Whirlwind

This comment has been minimized.

Copy link
Contributor Author

commented May 7, 2018

Maybe replace unzip with ditto:

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

This comment has been minimized.

Copy link

commented May 14, 2018

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

This comment has been minimized.

Copy link
Contributor Author

commented May 18, 2018

How to fix it now?

@HadrainChen

This comment has been minimized.

Copy link

commented May 29, 2018

Has anyone fix?

@Whirlwind

This comment has been minimized.

Copy link
Contributor Author

commented May 29, 2018

I replace unzip with ditto.

@golderzhang

This comment has been minimized.

Copy link

commented Jun 12, 2018

How to replace unzip ? Or other fix ?

@golderzhang

This comment has been minimized.

Copy link

commented Jun 13, 2018

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!

@Whirlwind

This comment has been minimized.

Copy link
Contributor Author

commented Jun 20, 2018

I hook the unzip function to ditto, it works.

@stale

This comment has been minimized.

Copy link

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 label Sep 18, 2018

@Whirlwind

This comment has been minimized.

Copy link
Contributor Author

commented Sep 18, 2018

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 https://github.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 label Sep 18, 2018

@stale

This comment has been minimized.

Copy link

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 label Dec 17, 2018

@amorde

This comment has been minimized.

Copy link
Member

commented Dec 19, 2018

This seems like something we can fix.

@stale stale bot removed the s1:awaiting input label Dec 19, 2018

@Whirlwind

This comment has been minimized.

Copy link
Contributor Author

commented Dec 19, 2018

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

This comment has been minimized.

Copy link

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 label Mar 19, 2019

@stale

This comment has been minimized.

Copy link

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 Mar 26, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.