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

Cannot change tmp directory when dumping #1103

Closed
2 of 6 tasks
axeloz opened this issue Mar 2, 2017 · 6 comments · Fixed by #1915
Closed
2 of 6 tasks

Cannot change tmp directory when dumping #1103

axeloz opened this issue Mar 2, 2017 · 6 comments · Fixed by #1915
Labels
type/enhancement An improvement of existing functionality
Milestone

Comments

@axeloz
Copy link

axeloz commented Mar 2, 2017

  • Gitea version (or commit ref): 1.0.1
  • Git version: 1.9.1
  • Operating system: Ubuntu
  • Database (use [x]):
    • PostgreSQL
    • MySQL
    • SQLite
  • Can you reproduce the bug at https://try.gitea.io:
    • Yes (provide example URL)
    • No
    • Not relevant

Description

I want to dump my Gitea instance using
./gitea dump

Unfortunately my primary partition is nearly full so the dump fails and I need to change the tmp directory that Gitea will use. In order to do so, I issue a :
./gitea dump -t ./tmp

The dump works better until I get :
Fail to save gitea-dump-1488467761.zip: write /tmp/cae/gitea-dump-1488467761.zip/gitea-repo.zip: no space left on device

This means Gitea keeps using the /tmp directory instead of the ./tmp I have created on another partition.

Thanks

@lunny lunny added this to the 1.x.x milestone Mar 2, 2017
@lunny lunny added the type/enhancement An improvement of existing functionality label Mar 2, 2017
@axeloz
Copy link
Author

axeloz commented Mar 2, 2017

I forgot to attach the full log. As you can see, the dump utility starts using the "./tmp" dir but fails at the end on "/tmp"

git@new:~/gitea$ ./gitea dump -t ./tmp/
2017/03/02 16:13:24 Creating tmp work dir: tmp/gitea-dump-488981595
2017/03/02 16:13:24 Dumping local repositories.../data/git/repositories
2017/03/02 16:16:01 Dumping database...
2017/03/02 16:16:01 Packing dump files...
2017/03/02 16:16:41 Fail to save gitea-dump-1488467761.zip: write /tmp/cae/gitea-dump-1488467761.zip/gitea-repo.zip: no space left on device

@cez81
Copy link
Contributor

cez81 commented Mar 2, 2017

@lunny I can have a look at this one.

@cez81
Copy link
Contributor

cez81 commented Mar 2, 2017

Try setting the TMPDIR (or equivalent for your dist) enviroment variable to same tmp dir.

The use of /tmp actually comes from the cae/zip-library. See https://github.com/Unknwon/cae/blob/master/zip/write.go#L169

@lunny Don't think I should change it the imported library right?

@axeloz
Copy link
Author

axeloz commented Mar 3, 2017

Setting the TMPDIR works :

git@new:~/gitea$ export TMPDIR=./tmp
git@new:~/gitea$ ./gitea dump -t ./tmp/
2017/03/03 10:24:42 Creating tmp work dir: tmp/gitea-dump-334154876
2017/03/03 10:24:42 Dumping local repositories.../data/git/repositories
2017/03/03 10:27:20 Dumping database...
2017/03/03 10:27:20 Packing dump files...
2017/03/03 10:29:46 Removing tmp work dir: tmp/gitea-dump-334154876
2017/03/03 10:29:46 Finish dumping in file gitea-dump-1488533240.zip

Thanks

@lunny
Copy link
Member

lunny commented Mar 3, 2017

@cez81 Yes. Except especially critical situation, we will fire an issue to the original library and wait the upstream library update.

@bkcsoft
Copy link
Member

bkcsoft commented Apr 18, 2017

@lunny As a work-around we could set TMPDIR if it isn't already set?

if os.Getenv("TMPDIR") == "" {
  os.Setenv("TMPDIR", tmpDir)
}

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type/enhancement An improvement of existing functionality
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants