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

Error: Os { code: 21, kind: Other, message: "Is a directory" } #11

Closed
ghost opened this issue Oct 16, 2018 · 7 comments
Closed

Error: Os { code: 21, kind: Other, message: "Is a directory" } #11

ghost opened this issue Oct 16, 2018 · 7 comments
Labels
bug Something isn't working

Comments

@ghost
Copy link

ghost commented Oct 16, 2018

I'm attempting to use warp-packer to package a directory of files alongside a single go binary and hit the error titled. It's a bit cryptic so I started yanking stuff out and noticed it's only occurring when a directory exists in myapp.

Expand to view output from tree
.
├── exec
├── hugo
└── site
    ├── archetypes
    │   └── default.md
    ├── config.toml
    ├── content
    │   └── post
    │       └── welcome.md
    ├── data
    ├── layouts
    ├── static
    └── themes
        ├── after-dark
        │   ├── CHANGELOG.md
        │   ├── COPYING
        │   ├── README.md
        │   ├── after-dark-6.13.2.tgz
        │   ├── archetypes
        │   │   ├── default.md
        │   │   ├── post.md
        │   │   └── search.md
        │   ├── assets
        │   │   └── css
        │   │       ├── custom.css
        │   │       ├── theme.css
        │   │       └── vendor
        │   │           └── hack
        │   │               ├── dark-grey.css
        │   │               ├── dark.css
        │   │               ├── hack.css
        │   │               ├── solarized-dark.css
        │   │               └── standard.css
        │   ├── bin
        │   │   ├── help
        │   │   ├── install
        │   │   └── upgrade
        │   ├── data
        │   │   └── npm
        │   │       └── latest.json
        │   ├── docker
        │   │   └── hugo
        │   │       └── Dockerfile
        │   ├── docs
        │   │   ├── archetypes
        │   │   │   ├── feature.md
        │   │   │   ├── module.md
        │   │   │   ├── shortcode.md
        │   │   │   └── validate.md
        │   │   ├── config.toml
        │   │   ├── content
        │   │   │   ├── _index.md
        │   │   │   ├── extra
        │   │   │   │   └── high-tea.md
        │   │   │   ├── feature
        │   │   │   │   ├── _index.md
        │   │   │   │   ├── air-gapping.md
        │   │   │   │   ├── code-highlighter.md
        │   │   │   │   ├── custom-layouts.md
        │   │   │   │   ├── custom-styles.md
        │   │   │   │   ├── display-variants.md
        │   │   │   │   ├── error-page.md
        │   │   │   │   ├── fetch-injection.md
        │   │   │   │   ├── fuzzy-search.md
        │   │   │   │   ├── index-blocking.md
        │   │   │   │   ├── jit-requests.md
        │   │   │   │   ├── keywords-meta.md
        │   │   │   │   ├── last-modified.md
        │   │   │   │   ├── lazy-loading.md
        │   │   │   │   ├── link-typing.md
        │   │   │   │   ├── module-system.md
        │   │   │   │   ├── online-help.md
        │   │   │   │   ├── post-bylines.md
        │   │   │   │   ├── post-images.md
        │   │   │   │   ├── quick-installer.md
        │   │   │   │   ├── referrer-policy.md
        │   │   │   │   ├── related-content.md
        │   │   │   │   ├── release-hashes.md
        │   │   │   │   ├── section-menu.md
        │   │   │   │   ├── snippets.md
        │   │   │   │   ├── social-meta.md
        │   │   │   │   ├── structured-data.md
        │   │   │   │   ├── svg-favicon.md
        │   │   │   │   ├── table-of-contents.md
        │   │   │   │   ├── taxonomy-pages.md
        │   │   │   │   ├── telegram-iv.md
        │   │   │   │   ├── trim-color.md
        │   │   │   │   ├── upgrade-script.md
        │   │   │   │   └── webmaster-tools.md
        │   │   │   ├── module
        │   │   │   │   ├── _index.md
        │   │   │   │   ├── fractal-forest.md
        │   │   │   │   ├── hall-of-mirrors.md
        │   │   │   │   ├── toxic-swamp
        │   │   │   │   │   └── configuration.md
        │   │   │   │   ├── toxic-swamp.md
        │   │   │   │   └── voyeur.md
        │   │   │   ├── search
        │   │   │   │   └── _index.md
        │   │   │   ├── shortcode
        │   │   │   │   ├── _index.md
        │   │   │   │   ├── alert.md
        │   │   │   │   ├── blockquote.md
        │   │   │   │   ├── button-group.md
        │   │   │   │   ├── button.md
        │   │   │   │   ├── card.md
        │   │   │   │   ├── external.md
        │   │   │   │   ├── figure.md
        │   │   │   │   ├── form-group.md
        │   │   │   │   ├── form.md
        │   │   │   │   ├── help-block.md
        │   │   │   │   ├── label.md
        │   │   │   │   ├── progress.md
        │   │   │   │   ├── text-area.md
        │   │   │   │   ├── text-input.md
        │   │   │   │   └── throbber.md
        │   │   │   └── validate.md
        │   │   ├── index.html
        │   │   ├── layouts
        │   │   │   ├── extra
        │   │   │   │   ├── list.html
        │   │   │   │   └── single.html
        │   │   │   ├── feature
        │   │   │   │   ├── list.html
        │   │   │   │   └── single.html
        │   │   │   ├── index.html
        │   │   │   ├── module
        │   │   │   │   ├── list.html
        │   │   │   │   └── single.html
        │   │   │   ├── partials
        │   │   │   │   ├── category-link.html
        │   │   │   │   ├── definition-data.html
        │   │   │   │   ├── feature-link.html
        │   │   │   │   ├── module-latest.html
        │   │   │   │   ├── module-link.html
        │   │   │   │   └── shortcode-link.html
        │   │   │   ├── shortcode
        │   │   │   │   ├── list.html
        │   │   │   │   └── single.html
        │   │   │   └── shortcodes
        │   │   │       └── include.html
        │   │   ├── resources
        │   │   │   └── _gen
        │   │   │       └── assets
        │   │   │           └── css
        │   │   │               └── css
        │   │   │                   ├── theme.css_d3f53f09220d597dac26fe7840c31fc9.content
        │   │   │                   └── theme.css_d3f53f09220d597dac26fe7840c31fc9.json
        │   │   ├── s3_website.yml
        │   │   ├── static
        │   │   │   └── images
        │   │   │       ├── addon-high-tea_1440x900-fs8.png
        │   │   │       ├── addon-high-tea_720x450-fs8.png
        │   │   │       ├── instant-view-fs8.png
        │   │   │       ├── minimal-mac_1600x1200-fs8.png
        │   │   │       ├── minimal-mac_800x600-fs8.png
        │   │   │       ├── social-awareness-fs8.png
        │   │   │       └── wtfpl.svg
        │   │   └── themes
        │   │       └── after-dark -> ../..
        │   ├── images
        │   │   ├── minimal-mac.png
        │   │   ├── screenshot.png
        │   │   └── tn.png
        │   ├── layouts
        │   │   ├── 404.html
        │   │   ├── _default
        │   │   │   ├── baseof.html
        │   │   │   ├── index.json
        │   │   │   ├── list.html
        │   │   │   ├── search.html
        │   │   │   ├── single.html
        │   │   │   ├── taxonomy.html
        │   │   │   └── terms.html
        │   │   ├── index.html
        │   │   ├── partials
        │   │   │   ├── async-scripts.html
        │   │   │   ├── components
        │   │   │   │   ├── alert.html
        │   │   │   │   ├── button.html
        │   │   │   │   ├── buttongroup.html
        │   │   │   │   ├── card.html
        │   │   │   │   ├── common
        │   │   │   │   │   └── textattrs.html
        │   │   │   │   ├── form.html
        │   │   │   │   ├── formactions.html
        │   │   │   │   ├── formgroup.html
        │   │   │   │   ├── helpblock.html
        │   │   │   │   ├── label.html
        │   │   │   │   ├── progress.html
        │   │   │   │   ├── select.html
        │   │   │   │   ├── textarea.html
        │   │   │   │   ├── textinput.html
        │   │   │   │   └── throbber.html
        │   │   │   ├── global-styles.html
        │   │   │   ├── head
        │   │   │   │   ├── favicon.html
        │   │   │   │   └── site-verification.html
        │   │   │   ├── menu.html
        │   │   │   ├── meta
        │   │   │   │   ├── http-referrer.html
        │   │   │   │   ├── name-author.html
        │   │   │   │   ├── ogimage-maybe.html
        │   │   │   │   ├── telegram-channel-maybe.html
        │   │   │   │   └── theme-color.html
        │   │   │   ├── modules-footer.html
        │   │   │   ├── modules.html
        │   │   │   ├── page-summary.html
        │   │   │   ├── pagination.html
        │   │   │   ├── post
        │   │   │   │   ├── byline.html
        │   │   │   │   ├── category-link.html
        │   │   │   │   ├── meta.html
        │   │   │   │   ├── related-content.html
        │   │   │   │   └── tag-link.html
        │   │   │   ├── powered-by.html
        │   │   │   ├── shortcode
        │   │   │   │   ├── external.html
        │   │   │   │   └── navmenu.html
        │   │   │   └── toc-maybe.html
        │   │   ├── post
        │   │   │   └── single.html
        │   │   └── shortcodes
        │   │       ├── blockquote.html
        │   │       ├── external.html
        │   │       ├── figure.html
        │   │       ├── hackcss-alert.html
        │   │       ├── hackcss-button.html
        │   │       ├── hackcss-buttongroup.html
        │   │       ├── hackcss-card.html
        │   │       ├── hackcss-form.html
        │   │       ├── hackcss-formgroup.html
        │   │       ├── hackcss-helpblock.html
        │   │       ├── hackcss-label.html
        │   │       ├── hackcss-progress.html
        │   │       ├── hackcss-textarea.html
        │   │       ├── hackcss-textinput.html
        │   │       ├── hackcss-throbber.html
        │   │       └── navmenu.html
        │   ├── package.json
        │   └── static
        │       ├── css
        │       │   └── syntax.css
        │       └── js
        │           ├── fuse.min.js
        │           ├── lazysizes.min.js
        │           ├── lodash.custom.min.js
        │           ├── mark.min.js
        │           ├── smoothscroll.js
        │           └── vue.min.js
        └── fractal-forest
            ├── CHANGELOG.md
            ├── COPYING
            ├── Dockerfile
            ├── README.md
            ├── bin
            │   └── generate-hashes.sh
            ├── layouts
            │   └── partials
            │       └── modules
            │           └── fractal-forest
            │               └── index.html
            ├── package.json
            └── static
                ├── bpg
                │   └── cinemagraph-6.bpg
                └── js
                    ├── bpgdec.js
                    ├── bpgdec.js.sha384
                    ├── bpgdec8.js
                    ├── bpgdec8.js.sha384
                    ├── bpgdec8a.js
                    └── bpgdec8a.js.sha384

68 directories, 205 files

Here's the contents of my exec file:

#!/bin/sh

DIR="$(cd "$(dirname "$0")" ; pwd -P)"
HUGO_EXE="$DIR/hugo"
SITE_PATH="$DIR/site"

exec "$HUGO_EXE" -s "$SITE_PATH" "$@

Here's the command I ran to produce the error:

./warp-packer --arch macos-x64 --input_dir myappp --exec exec --output ad

And the output from the packer --version flag: warp-packer 0.2.1

If I remove the site directory packing works fine and I'm able to execute. Not sure what to try next. I wasn't able to find anything about the error online and finagling my exec script had no effect.

Please let me know if you'd like me to upload a test case. The source code is open.

@dgiagio
Copy link
Owner

dgiagio commented Oct 16, 2018

Thanks for reporting this.

Could you please upload the entire directory tarball somewhere? I would like to reproduce it.

@ghost
Copy link
Author

ghost commented Oct 16, 2018

Aye aye, cap’n. https://mega.nz/#!iyYmTaAL!nhr1MD-Cf8-jIJ8PiSs1XUyQEQqRtpQ043siRtr4Egk

Nifty tool you got going on here. Hope I didn't derp something.

@dgiagio dgiagio reopened this Oct 16, 2018
@dgiagio
Copy link
Owner

dgiagio commented Oct 16, 2018

I've found the problem. When creating the tarball archive the library I'm using is throwing that error when there are symlinks pointing to relative paths. I've figured that out by using strace. The important part of the output is:

openat(AT_FDCWD, "myappp/site/themes/after-dark/docs", O_RDONLY|O_NONBLOCK|O_CLOEXEC|O_DIRECTORY) = 4
fstat(4, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
getdents(4, /* 11 entries */, 32768)    = 344
getdents(4, /* 0 entries */, 32768)     = 0
close(4)                                = 0
stat("myappp/site/themes/after-dark/docs", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
openat(AT_FDCWD, "myappp/site/themes/after-dark/docs/themes", O_RDONLY|O_NONBLOCK|O_CLOEXEC|O_DIRECTORY) = 4
fstat(4, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
getdents(4, /* 3 entries */, 32768)     = 80
getdents(4, /* 0 entries */, 32768)     = 0
close(4)                                = 0
stat("myappp/site/themes/after-dark/docs/themes", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
openat(AT_FDCWD, "myappp/site/themes/after-dark/docs/themes/after-dark", O_RDONLY|O_CLOEXEC) = 4
fstat(4, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
read(4, 0x7ffffbbdb1d8, 8192)           = -1 EISDIR (Is a directory)
close(4)                                = 0

myappp/site/themes/after-dark/docs/themes/after-dark is a symlink to ../.. and that's confusing the tar-rs library.

I've fixed the issue by not following symlinks anymore, but rather adding them to the archive as is (which is what we expect).

@dgiagio
Copy link
Owner

dgiagio commented Oct 16, 2018

I've created a pre-release for macOS (which seems to be what you are using). Could you please download the updated packer and check if that works?

https://github.com/dgiagio/warp/releases/download/v0.2.2-rc.1/macos-x64.warp-packer

@dgiagio dgiagio added the bug Something isn't working label Oct 16, 2018
@ghost
Copy link
Author

ghost commented Oct 17, 2018

Thanks for your quick action and familiarizing me with strace. Effective debugging tool, looks like. Made a mirror of it on my git server so I remember to come back to it later.

I've created a pre-release for macOS (which seems to be what you are using). Could you please download the updated packer and check if that works?

Pulled the pre-release and the packer and updated the exec command in the launcher script like so:

exec "$HUGO_EXE -s $SITE_PATH" "$@"

Progress. Then I checked "Application Support" directory and the expected files exist (including symlink) and runs as expected when I cd to it and run ./hugo -s site.

I did see the following issue which prevents me from running the packaged warp binary, however, which is a blocker for me on my current machine but may not be related to this issue:

/Users/jhabdas/Library/Application Support/warp/packages/ad/exec: line 7: /Users/jhabdas/Library/Application Support/warp/packages/ad/hugo -s /Users/jhabdas/Library/Application Support/warp/packages/ad/site: No such file or directory

The output above causes the ad binary to abend but only because, when run from tty, a \ terminator is expected before the space in the path on my machine, e.g. "Application\ Support".

Edit: The error is obviously coming from the hugo binary so it's clearly unrelated and something I should probably resolve on my end. Thanks again for the super quick help here.

@dgiagio
Copy link
Owner

dgiagio commented Oct 17, 2018

If you execute your exec file manually you will receive the same error, which means the problem is the script.

Try changing the quotes like this:

exec "$HUGO_EXE" -s "$SITE_PATH" "$@"

@ghost
Copy link
Author

ghost commented Oct 17, 2018

Comically that's what I had before I made the update. Works perfectly now. Thanks, bos.

@ghost ghost closed this as completed Oct 17, 2018
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant