sourcegraph/dev
Thorsten Ball b70728ba06
sg: update binary correctly instead of renaming file (#33957)
Linux users on Slack reported that `sg update` produces this error:

    >  sg update
    error: rename /tmp/sg1226370089/sg /home/fkling/.local/bin/sg: invalid cross-device link

As Geoffrey pointed out:

> rename only works within the same filesystem. I think the implementation should just copy / delete the file instead.

And the [man page for rename](https://linux.die.net/man/2/rename) says:

> oldpath and newpath are not on the same mounted file system. (Linux permits a file system to be mounted at multiple points, but rename() does not work across different mount points, even if the same file system is mounted on both.)

So what this here does is to use code from `gitserver` that does an
in-place update of a file safele. I extracted the code into an
`internal/fileutil` package (couldn't think of a better name).

The code avoids the across-filesystem problem by creating a temp file
next to the destination file. And it also does more things, like making
sure the changes are synced to the filesystem.
2022-04-15 08:52:07 +02:00
..
auth-provider Remove left-over mentions of dev/start.sh (#25745) 2021-10-07 16:38:00 +02:00
authtest [cloud] Add email to inviteUserToOrganization mutation (#30632) 2022-02-04 09:22:37 +01:00
bkstats ci: fix a typo in bkstats README (#31846) 2022-02-25 14:41:28 +01:00
buildchecker buildchecker-history: run weekly (#32224) 2022-03-07 09:01:23 -08:00
check dev/sg: command, flag, and argument autocompletions (#33817) 2022-04-13 09:55:09 -07:00
ci ci: run client linters on changed files (#33701) 2022-04-14 00:37:25 -07:00
codeintel-qa golangci-lint: enable unparam linter (#31856) 2022-02-28 15:31:44 +01:00
corrupt-archives errors: Introduce internal package (#30558) 2022-02-07 15:03:45 +00:00
db dev/deb: Remove scripts replaced by sg (#28767) 2021-12-08 23:22:00 +00:00
depgraph errors: Remove additional cockroachdb uses (#31512) 2022-02-18 20:23:46 +00:00
gitserver gitserver: fix local config for multi-instance (#32501) 2022-03-11 16:48:39 +04:00
gqltest insights: Add backend integration tests (#33451) 2022-04-07 15:39:41 -04:00
grafana dev/sg: introduce 'sg ci logs' with Loki support (#25835) 2021-10-12 11:14:50 -04:00
nix nix: specify PGUSER (#25546) 2021-09-30 13:23:43 +02:00
phabricator all: /bin/bash -> /usr/bin/env bash (#23673) 2021-08-06 12:02:43 +02:00
pr-auditor pr-auditor: support test plans in poorly formatted markdown (#33624) 2022-04-07 21:25:50 +00:00
prometheus Remove query runner (#28333) 2021-11-30 10:13:20 -07:00
release ci: run client linters on changed files (#33701) 2022-04-14 00:37:25 -07:00
schemadoc add codeinsights db to schemadoc (#33293) 2022-03-31 16:09:43 -04:00
sg sg: update binary correctly instead of renaming file (#33957) 2022-04-15 08:52:07 +02:00
src-expose Update base alpine images (#33938) 2022-04-14 17:37:12 -03:00
team chore: Update go-mockgen (#33678) 2022-04-08 16:07:50 -05:00
tilt Remove left-over mentions of dev/start.sh (#25745) 2021-10-07 16:38:00 +02:00
ts-morph Move all client code into client/ folder (#14480) 2020-10-07 22:23:53 +02:00
zoekt gomod: update zoekt (#31041) 2022-02-11 08:54:54 +00:00
.gitignore dev: remove nginx (#13299) 2021-02-18 14:38:58 +00:00
add_https_domain_to_hosts.sh dev: add shfmt for shell script consistency (#9900) 2020-04-15 12:44:36 -07:00
caddy.sh Bump caddy version (#26329) 2021-10-19 22:06:22 +00:00
Caddyfile Run 'caddy fmt Caddyfile' (#31824) 2022-02-24 23:27:57 +00:00
CLA.txt Publish Sourcegraph as open source 🚀 2018-09-30 23:13:36 -07:00
codecov.yml vscode: ignore vscode in Codecov (#32676) 2022-03-16 11:28:28 -04:00
codeinsights-db.sh insights: update references to TimescaleDB (#32948) 2022-03-29 11:04:47 +01:00
comby-install-or-upgrade.sh search: update comby dependecies for 0.18.1 (#12959) 2020-08-14 10:55:09 -07:00
config.json Enable Campaigns by default (with write-access only for admins) (#11621) 2020-08-24 11:05:36 +02:00
dev-sourcegraph-server.sh ci: add shellcheck linter for shell scripts (#9903) 2020-04-21 10:03:17 -07:00
docsite.sh update docsite and remove insights from the docs pages (#30910) 2022-02-09 15:42:43 -07:00
drop-entire-local-database-and-redis.sh all: /bin/bash -> /usr/bin/env bash (#23673) 2021-08-06 12:02:43 +02:00
foreach-ts-project.sh ci: run client linters on changed files (#33701) 2022-04-14 00:37:25 -07:00
generate.sh lsif typed syntax highlighter v0.1 (#30016) 2022-02-23 11:44:17 -05:00
git-stats search: create and document git-stats script (#32663) 2022-03-16 13:41:17 +02:00
global-settings.json Insights: filter returned insights based on graphQL id argument (#22695) 2021-07-08 13:30:18 -07:00
go-mod-update.sh Upgrade aws-sdk-go-v2 (#19155) 2021-04-14 15:06:15 +02:00
golangci-lint.sh ci: downgrade golangci-lint (#33022) 2022-03-24 19:05:26 +00:00
licenses.sh doc/dev: migrate continuous_integration.md to ci/index.md (#31905) 2022-02-28 08:16:20 -08:00
mockgen.sh chore: Update go-mockgen (#33678) 2022-04-08 16:07:50 -05:00
postgres_exporter.sh migrations: Update postgres exporter queries for dirty database (#30774) 2022-02-10 17:40:09 -06:00
proto-generate.sh lsif typed syntax highlighter v0.1 (#30016) 2022-02-23 11:44:17 -05:00
prune-pick.sh ci: add shellcheck linter for shell scripts (#9903) 2020-04-21 10:03:17 -07:00
redis-postgres.yml Update Postgres to 12.7 (#31933) 2022-03-03 14:39:52 -06:00
redis.conf Local dev with docker-compose (#23537) 2021-08-06 22:11:40 +00:00
run-server-image.sh insights: Add backend integration tests (#33451) 2022-04-07 15:39:41 -04:00
site-config.json New Password Policy (#31881) 2022-04-11 11:29:35 -05:00
src-prof-services.json Remove query runner (#28333) 2021-11-30 10:13:20 -07:00
src-search-meta.sh GraphQL: remove deprecated resultCount field (#31573) 2022-02-21 12:03:36 -07:00
tools.go chore: Use tools.go over unused functions to keep dependencies in go.sum (#31930) 2022-02-28 14:58:19 +00:00