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

self-update: Figure out correct path to the restic binary #2041

Closed
fd0 opened this Issue Oct 14, 2018 · 2 comments

Comments

Projects
None yet
2 participants
@fd0
Copy link
Member

fd0 commented Oct 14, 2018

The restic self-update command uses the wrong path to the restic binary to update. When restic is in the PATH and restic self-update is run, it'll leave a new binary in the current directory.

For a user report see #1949 (comment)

@fd0 fd0 added bug confirmed labels Oct 14, 2018

@fd0 fd0 referenced this issue Oct 14, 2018

Merged

Add command self-update #1949

6 of 7 tasks complete
@wscott

This comment has been minimized.

Copy link

wscott commented Oct 14, 2018

FYI, I think this is the API you want:
https://tip.golang.org/pkg/os/#Executable
(as of go 1.8)

@fd0

This comment has been minimized.

Copy link
Member

fd0 commented Oct 14, 2018

Cool, thanks!

@fd0 fd0 closed this in #2042 Oct 14, 2018

bahelit added a commit to bahelit/restic that referenced this issue Jan 11, 2019

merge from master fork (#2)
* Add the SPEC file restic.spec to build RPMs

Tested on Fedora 28, RHEL 6 and 7

* Small change for RHEL6 which does not know about the %license macro

* prune: Fix calculation for removed bytes

* release.go: Add version to global.go

Closes restic#1958

* Update version in build.go

* stats: Show what was scanned and scanning mode used

* doc: Add explanation for "processed" vs "added"

* ls: Add JSON output support for restic ls cmd

* add changelog entry

* fix: switch struct_type value to lower case

* Improve changelog entry

* ls: Stream output when using --json option

* Select specific Node fields for listing

* Add changelog entry

* ui/table: Add small package for writing tables

* find: Add support for blobs, IDs and packs lookups

With --blob, --tree and --pack, the find command now lists the snapshots
that contain a specific tree or blob, or the snapshots that contain
blobs belonging to a given pack.
It also displays the pack ID a blob belongs to.

A list of IDs can be given, as long as the IDs are all of the same type.

* walker.Walk: Pass parent tree-id to WalkFunc

* find: Add support for multiple patterns or objects

* walk: Pass parent tree ID to WalkFunc

* Add entry to changelog (new find flags)

* forget: Display reasons why snapshots are kept

This change displays the reasons for keeping a snapshot in the table,
unless `--compact` is specified.

* Vendor cmpopts

* Remove old text table implementation

* Add entry to changelog

* <docs/manual_rest: Fix broken link to restc Design page>

* Fix comment

* Improve changelog entry (pull-1780)

* Make generated man pages more easy to read with items

Allow Cobra to output a more list items friendly format, this make
reading of the documentation more easily using information from
manpages.

* doc: Add list of environment variables

* Update B2 env variable information

* Fixed the B2 environment variables as they had the same description
* Added the variables for the newly introduced Application Key support restic#1906

* cache: Print message when new cache is created

Sometimes, users run restic without retaining the local cache
directories. This was reported several times in the past.

Restic will now print a message whenever a new cache directory is
created from scratch (i.e. it did not exist before), so users have a
chance to recognize when the cache is not kept between different runs of
restic.

* build.go: Don't ignore error

* Fix formatting for gofmt with Go 1.11

* Only run gofmt for latest stable version

* Document gofmt version

* Add Go 1.11 to CI tests

* run_integration_tests: Replace dep with Go modules

* Vendor dependencies with `go mod vendor`

* build.go: Set GOPROXY=off

* Set GOXPROXY=off for tests, run with -mod=vendor

* Add entry to changelog

* build.go: Major rework, support Go modules

* Travis: Run build.go with -mod=vendor

* Makefile: Try -mod=vendor first

* Update docs for Go 1.11

* Travis: Run with -mod=vendor only for Go >= 1.11

* Travis: don't use GOPATH for Go >= 1.11

* Travis: Remove gotestcover

* Travis: Cache Go build artifacts

* Appveyor: Cache Go build cache

* Travis: Also cache on Darwin

* Travis: Also cache $GOPATH/pkg/mod

* Travis: Don't use cached test results

* Appveyor: correct build cache location

* Update installation instructions

- sort sections for different third-party methods
- Mention that Fedora can now just be installed via dnf
- Fix some typos

* clean up some errors from 'go vet ./...'

* Add section about FreeBSD, move anchor

* Correct name for Apple's desktop OS

* Add custom issue template

* Move template

* Test issue template

* Add template for "regular" issue

* scanner: Use context only for cancellation

When the scanner is slower than the actual backup, the tomb cancels the
context passed to Scan(), which then returns ctx.Err(). In the end, the
main function prints an error message that is not helpful ("Context
cancelled") and exits with an error code although no error occurred.

The code now ignores the error in the context and just uses it for
cancellation. The scanner is not supposed to return an error anyway.

Closes restic#1978

* Add entry to CHANGELOG

* Update dependencies

* Run 'go mod tidy'

* Run go mod tidy during CI

* restore: suppress lchown errors when not running as root

Like "cp -a" and "rsync -a" do, only report lchown errors if we run
as root.

Like cp from GNU coreutils does, we check Geteuid() to determine if
we are running as root
( http://git.savannah.gnu.org/cgit/coreutils.git/tree/src/copy.c#n3012 ).

On Windows, lchown errors are always reported.

Fixes restic#1766

* termstatus: detect and respect dumb terminals on Unix

Signed-off-by: Igor Fedorenko <igor@ifedorenko.com>

* Rename OS X to macOS in the documentation

macOS is the official name since the release of macOS 10.12 (Sierra).

* Add Scoop installation method to the documentation

* Update github.com/minio/minio-go

Closes restic#1918

* Add hint for FUSE on FreeBSD

* docs: Explain recognizing modified files

* Expand Glob (wildcards character) in paths in file in --files-from

* Add changelog unreleased file

* Reword changelog

* backup: Improve error message for invalid pattern

* Add minimal docs for the top-level package

Closes restic#173

* Use `--host` for all commands, deprecate --hostname

* docker: Base image on latest alpine release

* cache: Recheck before downloading

* cache: Fix recheck logic, remove channel from inProgress

* Add defaults to command line help of --cache-dir

* b2: simplify object iteration

Blazer is moving to a simpler object list interface, so I'm changing
this here as well.

* Update Go version to 1.11.1 in Docker build script

Restic cannot be built with Go 1.8.3 any more, it requires at least Go
1.9.0.

* Print base directory with cache command

* Escape subcommand in docker build script

* use latest instead of newest in forget language

* Add example to spot path expansion errros

* Output directory size in cache command

* Use correct method for joining paths

* Catch errors when walking cache directories

* doc: cache: fix typo

* Add entry to changelog

* Remove build tag `release`

* doc: Add developer information

* Move scripts/ to helpers/

* Add build-release-binaries

* Document the build and release processes

* changelog: Rename issue

* Prepare changelog for 0.9.3

* Update prepare-release

* helpers: Don't run sha256sums in build

* helpers: Use version string in built binaries

* Generate CHANGELOG.md for 0.9.3

* Update manpages and auto-completion

* Add version for 0.9.3

* Set development version for 0.9.3

* snapshots: Don't print empty line for --compact

Closes restic#2038

* self-update: Use correct path to restic binary

Closes restic#2041

* self-update: Check current version before download

* Cleanup: more realistic restorer test data setup

Signed-off-by: Igor Fedorenko <igor@ifedorenko.com>

* restore: New optimized multithreaded implementation

Signed-off-by: Igor Fedorenko <igor@ifedorenko.com>

* restore: Removed legacy restore implementation

Signed-off-by: Igor Fedorenko <igor@ifedorenko.com>

* go mod vendor

Signed-off-by: Igor Fedorenko <igor@ifedorenko.com>

* restore: Move documentation to godoc

* restore: Rename things, match the rest of the project

* restore: Fix small memory leak in filesWriter, add tests

Signed-off-by: Igor Fedorenko <igor@ifedorenko.com>

* restore: Fix packcache capacity math with failed downloads

Signed-off-by: Igor Fedorenko <igor@ifedorenko.com>

* restore: Chang fileInfo to use snapshot location instead of target path

* uses less memory as common prefix is only stored once
* stepping stone for simpler error callback api, which
  will allow further memory footprint reduction

Signed-off-by: Igor Fedorenko <igor@ifedorenko.com>

* restore: significantly reduce memory footprint

reworked restore error callback to use file location
path instead of much heavier Node. this reduced restore
memory usage by as much as 50% in some of my tests.

Signed-off-by: Igor Fedorenko <igor@ifedorenko.com>

* restorer: Optimize empty file restore

don't create fileInfo structs for empty files. this saves memory.
this also avoids extra serial scan of all fileInfo, which should
make restore faster and more consistent.

Signed-off-by: Igor Fedorenko <igor@ifedorenko.com>

* restorer: Add a note on hardlink metadata

Signed-off-by: Igor Fedorenko <igor@ifedorenko.com>

* Rework changelog entry

* Add ssh binary to docker image to allow sftp repository

* restore: Close files tested with --verify

Before, the target files were opened once per blob and never closed,
this commit fixes that.

* tiny formatting fix

I noticed this discrepancy when trying to parse the output of restic.

* Fix incorrect command name in long doc for self-update

* Correct typo

* Correct ineffassign

Signed-off-by: Gábor Lipták <gliptak@gmail.com>

* Add 'recover' command

* Fix timestamps

* Update install instructions for Arch Linux

restic has been added to the official community repositories in august 2018.

* rclone: Inject debug logger for HTTP

* index: Correctly process errors listing all files

This also removes the now unused `list` and `worker` packages.

* index: Cancel context for tests

* index: Use interfaces instead of *repository.Repository

* index: Add tests for error conditions

* restic: Use local rand source instead of global one

* index.New: Test various error conditions

* Correct summary for restic#1978

* DownloadAndHash: Check error returned by Load()

* Add entry to CHANGELOG

* Display local time for all commands

* Add entry to changelog

* backup: Add warning when patterns do not match any files

* backup: Open repository before async status starts

Closes restic#2080

* dump: Use path instead of filepath

Some time ago we changed the paths in the repo to always use a slash for
separation, it seems we missed that the `dump` command still uses the
`filepath` package, so on Windows backslashes are used.

Closes restic#2079

* Fix error message on Windows

* Extend custom Duration granularity to hours and add tests

* stats: Add shorthand flag `-H` for host name filter

The default value of the `--host` flag was set to 'H' (the shorthand
version of the flag), this caused the snapshot lookup to fail.

Also add shorthand `-H` for `backup` command.

Closes restic#2040

* Add hint which OS are supported

Closes restic#2016

* Use local time for user-provided time of backup

* Add changelog entry

* Allow --files-from multiple times

Fixes restic#2085

* Rework changelog for restic#2085

* cache: Don't return an error for truncated files

Closes restic#1229
Closes restic#1328

* Add key hinting (restic#2097)

* gs: Respect bandwidth limiting

In 0dfdc11, accidentally we dropped
using the provided http.RoundTripper, this commits adds it back.

Closes restic#1989

* Add entry to changelog

* Update vendor/modules.txt

* Support time ranges expressed in hours in snapshot retention policies

Make restic forget --keep-within accept time ranges measured in hours and choose
accordingly which snapshots to keep and which to forget. Add relative tests.

* Update 'restic forget --keep-within' documentation and add changelog entry

* Add support for reading password from external command

This allows reading the password from an password manager (like "pass").

Signed-off-by: Juergen Hoetzel <juergen@archlinux.org>

* mount: Enable "DefaultPermissions" FUSE option by default

This enforces the Unix permissions of the snapshot files within the mounted filesystem, which will only allow users to access snapshot files if they had access to the file outside of the snapshot.

* Add changelog entry about "DefaultPermissions" change

* mount: Add "no-default-permissions" option

This option restores the previous behavior of `mount` by disabling the "DefaultPermissions" FUSE option. This allows any user that can access the mountpoint to read any file from the snapshot. Normal FUSE rules apply, so `allow-root` or `allow-other` can be used to allow users besides the mounting user to access these files.

* --one-file-system unsupported on Windows

* cmd: Don't exit if printing to stdout or stderr fails (closes restic#2102)

* Remove moot sudo usage from documentation

That usage of sudo only applies to the echo command itself. It has no
effect on the permissions of the stdout redirect.

* Fix a few typos in the FAQ doc.

* Prefer https:// links in the documentation

All the changed urls are available by way of https://. Most of them
already redirect.

* doc: Add more clarity to B2 application key

* Add documentation for `--password-command`

* mount: Turn on DefaultPermissions for --allow-other`

This commit changes the logic slightly: checking the permissions in the
fuse mount when nobody else besides the current user can access the fuse
mount does not sense. The current user has access to the repo files in
addition to the password, so they can access all data regardless of what
the fuse mount does.

Enabling `--allow-root` allows the root user to access the files in the
fuse mount, for this user no permission checks will be done anyway.

The code now enables `DefaultPermissions` automatically when
`--allow-other` is set, it can be disabled with
`--no-default-permissions` to restore the old behavior.

* Create changelog dir for 0.9.4

* release: Pull latest alpine image

* Generate CHANGELOG.md for 0.9.4

* Update manpages and auto-completion

* Add version for 0.9.4

* Set development version for 0.9.4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment