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

Uncaught exception with spk pack #3535

Open
ankitmhn opened this issue Jun 21, 2021 · 10 comments
Open

Uncaught exception with spk pack #3535

ankitmhn opened this issue Jun 21, 2021 · 10 comments
Labels
app-packaging Issues packaging apps bug

Comments

@ankitmhn
Copy link

ankitmhn commented Jun 21, 2021

I'm running into a an error when trying to package an app. spk dev seems to work fine and I can interact with the app within my sandstorm environment but I get the following when I try to run the spk dev my-app.spk command:

*** Uncaught exception *** sandstorm/spk.c++:1171: failed: expected children.empty(); got symlink, expected directory; target = /lib stack: 61306d 61186a 61094e 61089c 662ce3 663246

@zenhack
Copy link
Collaborator

zenhack commented Jun 21, 2021

I feel like I saw this recently sometime too and was too tired or busy to remember to investigate it. Thanks for the report.

@ocdtrekkie ocdtrekkie added app-packaging Issues packaging apps bug labels Jun 21, 2021
@zenhack
Copy link
Collaborator

zenhack commented Jun 21, 2021

Ok, yeah, I can reproduce this with the currrent master of https://github.com/zenhack/ttrss-sandstorm/. Notably, doing spk pack for Sandcal works fine. Sandcal doesn't use vagrant-spk. I don't have time to do a deep-dive debugging right now, will get back to it later, but some things worth looking into:

  • Can others reproduce the failure with the ttrss repo? If not this means there's likely some local environment state that's off.
  • Is this reproducible for fresh vagrant-spk projects?

@ankitmhn, am I reading correctly that you're running spk pack directly, i.e. not using vagrant-spk? Any additional info you can provide re: your dev environment and/or the app you're packaging might provide useful insight.

@ankitmhn
Copy link
Author

That is right. I am running spk pack directly without vagrant-spk. This is on a fresh sandstorm install but the app that I am trying to package is one that I had written a year ago and it used to package just fine back then.

@zenhack
Copy link
Collaborator

zenhack commented Jan 1, 2022

Ok, I finally got around to digging into this one in order to ship a ttrss update. It looks like what happens is:

  • Many distros (including debian) at some point made /bin a symlink to /usr/bin, and same for /lib, /lib64, and such.
  • spk dev picks up the new files when scanning for use as normal, but doesn't delete old entries unless the files cannot be found.
  • When it sees files in sandstorm-files.list, it expects their containing directories not to be symlinks.
  • Because in a previous run, /bin, /lib etc. were not symlinks, and files under them were included, there are now stale entries in sandstorm-files.list that refer to things in directories that are actually symlinks.

I managed to work around this by just deleting all of the entries in my sandstorm-files.list that were underneath symlinks; the correct versions were already in the file.

Probably the right fix here is that spk should treat files in sandstom-files.list that are under symlinks as being "missing" and delete them as it does for other missing files.

@ocdtrekkie
Copy link
Collaborator

Was this also @orblivion's issue with Etherpad packaging?

@orblivion
Copy link
Contributor

orblivion commented Jan 1, 2022 via email

@orblivion
Copy link
Contributor

orblivion commented Jan 2, 2022 via email

@zenhack
Copy link
Collaborator

zenhack commented Jan 2, 2022

Note that in this instance I was talking about ttrss; I'm having other problems with the etherpad build which are not resolved, but they seem unrelated.

@orblivion
Copy link
Contributor

I just spent way too long figuring out behavior that seemed rather unpredictable to me. However most of it was related to a simple misunderstanding on my part of @zenhack's solution (which seems pretty dumb of me in retrospect). So, lest anybody else waste this time, I'll clarify:

In your sandstorm-files.list:

  • do delete files under the symlink directories (bin/bash, lib/x86_64-linux-gnu/libc.so.6, etc)
  • do not delete the symlinks themselves (bin, lib, lib64).

For entertainment's sake: If you do delete the symlinks, what will happen is that your spk will build. When you run it, you will find that not only can it not find anything under the bin directory, it can't find anything other than sandstorm-http-bridge. This is probably because the file system needs something under lib or lib64, the symlinks that you just deleted. You'll find that sandstorm-http-bridge can even be found if you move it to a different location within your app directory (and specify that location in sandstorm-pkgdef.capnp). But if you change the contents of sandstorm-http-bridge (to, let's say, the contents of /bin/ls) then it won't be able to find sandstorm-http-bridge anymore. Sheer madness, thankfully explained by a simple root cause.


There's still something I have to figure out related to generating sandstorm-files.list. Sometimes it actually doesn't include those files-under-symlinks and sometimes it does. I thought it was related to what directory I put sandstorm-pkgdef.capnp in and spk dev from, but I've realized that it doesn't seem to be consistent.

zenhack added a commit to zenhack/mediawiki-sandstorm that referenced this issue Mar 21, 2022
Was getting errors from spk pack due to
sandstorm-io/sandstorm#3535
@ocdtrekkie
Copy link
Collaborator

I just hit this issue today, though I built on an older sandstorm-files list to start from and upgraded the base box. The old package didn't have the issue (and didn't have the bin symlink in it's files list before I started). My guess is that the symlink prevents the file watcher from removing these files that no longer exist from the list, because they are now found via the symlink, so it still thinks they exist, until it tries to grab them for packing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
app-packaging Issues packaging apps bug
Projects
None yet
Development

No branches or pull requests

4 participants