]> git.ipfire.org Git - thirdparty/ccache.git/log
thirdparty/ccache.git
2 years agofeat: Improve error message when failing to parse command line config
Joel Rosdahl [Mon, 20 Feb 2023 19:56:09 +0000 (20:56 +0100)] 
feat: Improve error message when failing to parse command line config

2 years agochore: Remove now superfluous "this->" in lambda
Joel Rosdahl [Mon, 20 Feb 2023 19:51:27 +0000 (20:51 +0100)] 
chore: Remove now superfluous "this->" in lambda

It was needed for compatibility with older compilers.

2 years agochore: Always add -Wdouble-promotion to dev mode flags
Joel Rosdahl [Mon, 27 Feb 2023 20:13:19 +0000 (21:13 +0100)] 
chore: Always add -Wdouble-promotion to dev mode flags

Clang 3.4 is not longer supported anyway.

2 years agochore: Enable and fix some more warnings
Joel Rosdahl [Mon, 27 Feb 2023 18:22:45 +0000 (19:22 +0100)] 
chore: Enable and fix some more warnings

2 years agochore: Clean up Redis helper scripts a bit (#1254)
Anders Björklund [Wed, 22 Feb 2023 18:38:26 +0000 (19:38 +0100)] 
chore: Clean up Redis helper scripts a bit (#1254)

- Support any version of manifest and result.
- Skip over tmp dir and allow avoiding setnx.

2 years agofeat: Add support for setting per-compilation config on command line
Joel Rosdahl [Fri, 17 Feb 2023 07:26:08 +0000 (08:26 +0100)] 
feat: Add support for setting per-compilation config on command line

Closes #1035.

2 years agochore: Fix typos
Joel Rosdahl [Thu, 16 Feb 2023 06:40:58 +0000 (07:40 +0100)] 
chore: Fix typos

2 years agobump: Upgrade to zstd 1.5.4
Joel Rosdahl [Fri, 10 Feb 2023 19:32:56 +0000 (20:32 +0100)] 
bump: Upgrade to zstd 1.5.4

2 years agofix: Log config and command line before finding compiler
Joel Rosdahl [Wed, 8 Feb 2023 21:24:01 +0000 (22:24 +0100)] 
fix: Log config and command line before finding compiler

If the compiler can't be found then ccache exits early and doesn't print
the config and command line to the log. This makes it harder to debug
problems with finding the compiler, like issue #1249.

Improve this by logging "safe things" before searching for the compiler.

2 years agoperf: Don't update stats file when there are no incremented counters
Joel Rosdahl [Wed, 8 Feb 2023 21:08:43 +0000 (22:08 +0100)] 
perf: Don't update stats file when there are no incremented counters

This can happen for instance when ccache is about to exit with a fatal
error.

2 years agofix: Don't read first character of empty strings
Joel Rosdahl [Sat, 4 Feb 2023 14:33:45 +0000 (15:33 +0100)] 
fix: Don't read first character of empty strings

2 years agofix: Handle Unix-style paths as non-options to MSVC
Joel Rosdahl [Fri, 3 Feb 2023 12:11:57 +0000 (13:11 +0100)] 
fix: Handle Unix-style paths as non-options to MSVC

For MSVC, ccache treats all arguments starting with a slash as an
option, which makes it fail to detect the source code file if it's
passed as a Unix-style absolute path.

Fix this by not treating an argument as an option if it's (a) an unknown
option, and (b) the argument exists as a file in the file system.

Fixes #1230.

2 years agochore: Fix spelling in comment
Joel Rosdahl [Fri, 3 Feb 2023 06:32:45 +0000 (07:32 +0100)] 
chore: Fix spelling in comment

2 years agofeat: Log executed command lines on Windows
Joel Rosdahl [Thu, 2 Feb 2023 19:27:37 +0000 (20:27 +0100)] 
feat: Log executed command lines on Windows

2 years agofeat: Add quotes around arguments with space in logged command lines
Joel Rosdahl [Thu, 2 Feb 2023 19:25:34 +0000 (20:25 +0100)] 
feat: Add quotes around arguments with space in logged command lines

2 years agodocs: Fix bad reference to "Remote storage backends"
Joel Rosdahl [Wed, 1 Feb 2023 20:50:03 +0000 (21:50 +0100)] 
docs: Fix bad reference to "Remote storage backends"

2 years agofix: Fix rare crash in signal handler
Joel Rosdahl [Wed, 1 Feb 2023 20:04:39 +0000 (21:04 +0100)] 
fix: Fix rare crash in signal handler

If the process is signaled after SignalHandler::~SignalHandler has run
then this assert will trigger:

    ccache: SignalHandler.cpp:87: static void SignalHandler::on_signal(int): failed assertion: g_the_signal_handler

Fix this by deregistering the signal handler function before destructing
the SignalHandler object.

Fixes #1246.

2 years agobump: Upgrade to cpp-httplib 0.11.4
Joel Rosdahl [Tue, 31 Jan 2023 19:56:21 +0000 (20:56 +0100)] 
bump: Upgrade to cpp-httplib 0.11.4

2 years agobuild: Fix Zstd and Hiredis downloads for unstable GitHub archives
Joel Rosdahl [Mon, 30 Jan 2023 20:23:43 +0000 (21:23 +0100)] 
build: Fix Zstd and Hiredis downloads for unstable GitHub archives

The content of the Zstd and Hiredis GitHub source achive URLs like
<https://github.com/$X/$Y/archive/$tag.tar.gz> apparently change from
time to time. Color me surprised. [1] says that this is intentional
(although, at the time of writing, reverted temporarily). Let's use
another URL for Zstd and not verify the checksum for Hiredis (since
there is no release source archive).

[1]: https://github.blog/changelog/2023-01-30-git-archive-checksums-may-change/

2 years agoci: Upgrade to Node 16-based actions
Joel Rosdahl [Mon, 30 Jan 2023 19:31:34 +0000 (20:31 +0100)] 
ci: Upgrade to Node 16-based actions

Reference:
<https://github.blog/changelog/2022-09-22-github-actions-all-actions-will-begin-running-on-node16-instead-of-node12/>

2 years agofix: Cache path relativization in preprocessed output
Joel Rosdahl [Sun, 29 Jan 2023 12:12:30 +0000 (13:12 +0100)] 
fix: Cache path relativization in preprocessed output

After PR #1033 and [1], a stat call is made each time a note about an
include file is found in the preprocessed output. Such calls are very
performant on Linux (and therefore unnoticed until now), but apparently
costly on Windows.

Fix this by caching the calculation of relative paths in
process_preprocessed_file.

[1]: 9a05332915d2808f4713437006b3f7c812d9fd74

Closes #1245.

2 years agofix: Disable inode cache if filesystem risks getting full soon
Joel Rosdahl [Mon, 23 Jan 2023 21:14:54 +0000 (22:14 +0100)] 
fix: Disable inode cache if filesystem risks getting full soon

Some filesystems, for instance btrfs with compression enabled,
apparently make a posix_fallocate call succeed without actually
allocating the requested space for the file. This means that if the file
is mapped into memory, like done by the inode cache, the process can
crash when accessing the memory if the filesystem is full.

This commit implements a workaround: the inode cache is disabled if the
filesystem reports that it has less than 100 MiB free space. The free
space check is valid for one second before it is done again. This should
hopefully make crashes very rare in practice.

Closes #1236.

2 years agoci: Build macOS binary in release mode
Joel Rosdahl [Sun, 29 Jan 2023 11:36:13 +0000 (12:36 +0100)] 
ci: Build macOS binary in release mode

2 years agofeat: Allow forcing download of zstd and hiredis again
Joel Rosdahl [Fri, 27 Jan 2023 12:09:25 +0000 (13:09 +0100)] 
feat: Allow forcing download of zstd and hiredis again

Before it was possible to force downloading of the Zstandard library
using "-D ZSTD_FROM_INTERNET=ON" and similar for Hiredis. That ability
was lost in 2c742c2c7ca9, so if you for some reason want to not use a
locally installed library you're out of luck.

Improve this by letting ZSTD_FROM_INTERNET and HIREDIS_FROM_INTERNET be
tristate variables:

    ON: Always download
    AUTO (default): Download if local installation not found
    OFF: Never download

As mentioned in #1240.

2 years agochore: Improve variable name and comments
Joel Rosdahl [Mon, 23 Jan 2023 20:52:18 +0000 (21:52 +0100)] 
chore: Improve variable name and comments

2 years agodoc: Fix spelling
Joel Rosdahl [Thu, 19 Jan 2023 19:57:18 +0000 (20:57 +0100)] 
doc: Fix spelling

2 years agoci: Build macOS universal binary (#1240)
Raihaan Shouhell [Fri, 27 Jan 2023 12:02:38 +0000 (20:02 +0800)] 
ci: Build macOS universal binary (#1240)

2 years agofeat: Add support for -Wp,-U<macro> in direct mode
Joel Rosdahl [Wed, 18 Jan 2023 20:34:00 +0000 (21:34 +0100)] 
feat: Add support for -Wp,-U<macro> in direct mode

2 years agofix: Don't treat -Wp,-D as interchangeable with -D
Joel Rosdahl [Wed, 18 Jan 2023 20:30:25 +0000 (21:30 +0100)] 
fix: Don't treat -Wp,-D as interchangeable with -D

Fixes #1238.

2 years agotest: Use grep -E/-F instead of obsolescent egrep/fgrep
Joel Rosdahl [Tue, 17 Jan 2023 19:59:21 +0000 (20:59 +0100)] 
test: Use grep -E/-F instead of obsolescent egrep/fgrep

2 years agofeat: Improve automatic cache cleanup mechanism
Joel Rosdahl [Thu, 5 Jan 2023 18:14:27 +0000 (19:14 +0100)] 
feat: Improve automatic cache cleanup mechanism

The cache cleanup mechanism has worked essentially the same ever since
ccache was initially created in 2002:

- The total number and size of all files in one of the 16 subdirectories
  (AKA level 1) are kept in the stats file in said subdirectory.
- On a cache miss, the new compilation result file is written (based on
  the first digits of the hash) to a subdirectory of one of those 16
  subdirectories, and the stats file is updated accordingly.
- Automatic cleanup is triggered if the size of the level 1 subdirectory
  becomes larger than max_size / 16.
- ccache then lists all files in the subdirectory recursively, stats
  them to check their size and mtime, sorts the file list on mtime and
  deletes the 20% oldest files.

Some problems with the approach described above:

- (A) If several concurrent ccache invocations result in a cache miss
  and write their results to the same subdirectory then all of them will
  start cleaning up the same subdirectory simultaneously, doing
  unnecessary work.
- (B) The ccache invocation that resulted in a cache miss will perform
  cleanup and then exit, which means that an arbitrary ccache process
  that happens to trigger cleanup will take a long time to finish.
- (C) Listing all files in a subdirectory of a large cache can be quite
  slow.
- (D) stat-ing all files in a subdirectory of a large cache can be quite
  slow.
- (E) Deleting many files can be quite slow.
- (F) Since a cleanup by default removes 20% of the files in a
  subdirectory, the actual cache size will (once the cache limit is
  reached) on average hover around 90% of the configured maximum size,
  which can be confusing.

This commit solves or improves on all of the listed problems:

- Before starting automatic cleanup, a global "auto cleanup" lock is
  acquired (non-blocking) so that at most one process is performing
  cleanup at a time. This solves the potential "cache cleanup stampede"
  described in (A).
- Automatic cleanup is now performed in just one of the 256 level 2
  directories. This means that a single cleanup on average will be 16
  times faster than before. This improves on (B), (C), (D) and (E) since
  the cleanup made by a single compilation will not have to access a
  large part of the cache. On the other hand, cleanups will be triggered
  16 times more often, but the cleanup duty will be more evenly spread
  out during a build.
- The total cache size is calculated and compared with the configured
  maximum size before starting automatic cleanup. This, in combination
  with performing cleanup on level 2, means that the actual cache size
  will stay very close to the maximum size instead of about 90%. This
  solves (F).

The limit_multiple configuration option has been removed since it is no
longer used.

Closes #417.

2 years agochore: Add unit tests for parsing size with (undocumented) B suffix
Joel Rosdahl [Thu, 5 Jan 2023 18:14:17 +0000 (19:14 +0100)] 
chore: Add unit tests for parsing size with (undocumented) B suffix

2 years agoenhance: Delay LongLivedLockFileManager thread start to first register
Joel Rosdahl [Thu, 5 Jan 2023 10:38:55 +0000 (11:38 +0100)] 
enhance: Delay LongLivedLockFileManager thread start to first register

2 years agofix: Fix logging of inactive lock duration
Joel Rosdahl [Thu, 5 Jan 2023 10:16:28 +0000 (11:16 +0100)] 
fix: Fix logging of inactive lock duration

2 years agoenhance: Make it possible for LockFile::try_acquire to break the lock
Joel Rosdahl [Thu, 5 Jan 2023 10:07:06 +0000 (11:07 +0100)] 
enhance: Make it possible for LockFile::try_acquire to break the lock

If a long-lived lock is stale and has no alive file,
LockFile::try_acquire will never succeed to acquire the lock. Fix this
by creating the alive file for all lock types and making
LockFile::try_acquire exit when lock activity is seen instead of
immediately after failing to acquire the lock.

Another advantage is that a stale lock can now always be broken right
away if the alive file exists.

2 years agofeat: Consistently show cache size and max size with one decimal
Joel Rosdahl [Mon, 2 Jan 2023 19:46:25 +0000 (20:46 +0100)] 
feat: Consistently show cache size and max size with one decimal

2 years agoenhance: Make util::LockFile movable
Joel Rosdahl [Fri, 30 Dec 2022 21:00:17 +0000 (22:00 +0100)] 
enhance: Make util::LockFile movable

2 years agochore: Add missing explicit keywords to some constructors
Joel Rosdahl [Fri, 30 Dec 2022 20:59:18 +0000 (21:59 +0100)] 
chore: Add missing explicit keywords to some constructors

2 years agofix: Avoid sometimes too wide percent figure in --show-stats
Joel Rosdahl [Fri, 30 Dec 2022 20:49:23 +0000 (21:49 +0100)] 
fix: Avoid sometimes too wide percent figure in --show-stats

If the nominator is 99999 and the denominator is 100000, the percent
function in Statistics.cpp would return "(100.00%)" instead of the
wanted "(100.0%)". Fix this by using the alternate format string if the
result string overflows its target size.

2 years agoenhance: Add offsetted get/set/increment methods for StatisticsCounters
Joel Rosdahl [Wed, 28 Dec 2022 09:15:23 +0000 (10:15 +0100)] 
enhance: Add offsetted get/set/increment methods for StatisticsCounters

2 years agofeat: Activate logging for command mode options
Joel Rosdahl [Wed, 28 Dec 2022 09:11:55 +0000 (10:11 +0100)] 
feat: Activate logging for command mode options

This makes it possible to check ordinary log messages when debugging
"ccache -c" and similar options.

2 years agoenhance: Make storage::local::StatsFile movable
Joel Rosdahl [Wed, 14 Dec 2022 20:10:03 +0000 (21:10 +0100)] 
enhance: Make storage::local::StatsFile movable

2 years agodoc: Add note that "stats = false" will disable automatic cleanup
Joel Rosdahl [Wed, 14 Dec 2022 19:52:08 +0000 (20:52 +0100)] 
doc: Add note that "stats = false" will disable automatic cleanup

2 years agofeat: Do clean/clear/evict-style operations per level 2 directory
Joel Rosdahl [Tue, 29 Nov 2022 20:54:08 +0000 (21:54 +0100)] 
feat: Do clean/clear/evict-style operations per level 2 directory

Progress bars will now be smoother since the operations are now divided
into 256 instead of 16 "read files + act on files" steps. This is also
in preparation for future improvements related to cache cleanup.

2 years agorefactor: Merge LocalStorage implemention files
Joel Rosdahl [Tue, 29 Nov 2022 19:56:36 +0000 (20:56 +0100)] 
refactor: Merge LocalStorage implemention files

2 years agochore: Remove special logic for cleaning up legacy ccache files
Joel Rosdahl [Wed, 9 Nov 2022 20:36:03 +0000 (21:36 +0100)] 
chore: Remove special logic for cleaning up legacy ccache files

2 years agorefactor: Use std::size to compute array size
Joel Rosdahl [Tue, 10 Jan 2023 19:21:51 +0000 (20:21 +0100)] 
refactor: Use std::size to compute array size

2 years agochore: Clean up minor things after 95e6375813f7
Joel Rosdahl [Wed, 4 Jan 2023 14:17:11 +0000 (15:17 +0100)] 
chore: Clean up minor things after 95e6375813f7

2 years agofix: Use spinlocks for inode cache memory synchronization (#1229)
Oleg Sidorkin [Wed, 4 Jan 2023 13:53:21 +0000 (16:53 +0300)] 
fix: Use spinlocks for inode cache memory synchronization (#1229)

Changed the inode cache implementation to use spinlocks instead of pthread
mutexes. This makes the inode cache work on FreeBSD and other systems where the
pthread mutexes are destroyed when the last memory mapping containing the
mutexes is unmapped.

Also added tmpfs, ufs and zfs to the list of supported filesystems on macOS and
BSDs.

See also ccache discussion #1228.

2 years agoci: Test more compilers (#1234)
Raihaan Shouhell [Mon, 26 Dec 2022 11:48:55 +0000 (19:48 +0800)] 
ci: Test more compilers (#1234)

2 years agofix: Only use original umask when retrieving result
Joel Rosdahl [Fri, 23 Dec 2022 18:03:13 +0000 (19:03 +0100)] 
fix: Only use original umask when retrieving result

This fixes a problem where the original umask would be used when storing
a remote cache result in the local cache in from_cache.

Fixes #1235.

2 years agofix: Fix matching of base directory for MSVC
Joel Rosdahl [Wed, 21 Dec 2022 12:16:12 +0000 (13:16 +0100)] 
fix: Fix matching of base directory for MSVC

The base directory will now match case-insensitively with absolute paths
in preprocessed output, or from /showIncludes in the depend mode case,
when compiling with MSVC.

2 years agofix: Don't crash in TextTable for a single heading row
Joel Rosdahl [Wed, 21 Dec 2022 14:15:41 +0000 (15:15 +0100)] 
fix: Don't crash in TextTable for a single heading row

2 years agochore: Remove defunct LGTM badges
Joel Rosdahl [Fri, 23 Dec 2022 09:55:27 +0000 (10:55 +0100)] 
chore: Remove defunct LGTM badges

lgtm.com has been shut down.

2 years agofix: Do not escape backslashes in MSVC RSP files (#1233)
Raihaan Shouhell [Fri, 23 Dec 2022 09:52:45 +0000 (17:52 +0800)] 
fix: Do not escape backslashes in MSVC RSP files (#1233)

2 years agofix: Improve fix for local/remote cache misses in depend mode
Joel Rosdahl [Tue, 20 Dec 2022 20:57:33 +0000 (21:57 +0100)] 
fix: Improve fix for local/remote cache misses in depend mode

2 years agofix: Fix reporting of local/remote cache misses in depend mode
Joel Rosdahl [Tue, 13 Dec 2022 19:32:15 +0000 (20:32 +0100)] 
fix: Fix reporting of local/remote cache misses in depend mode

2 years agofix: Fix conditions for --show-stats
Joel Rosdahl [Mon, 12 Dec 2022 13:33:26 +0000 (14:33 +0100)] 
fix: Fix conditions for --show-stats

2 years agochore: Bump clang-format version requirement to 11+
Joel Rosdahl [Mon, 12 Dec 2022 18:46:01 +0000 (19:46 +0100)] 
chore: Bump clang-format version requirement to 11+

2 years agodoc: Fix markup
Joel Rosdahl [Mon, 12 Dec 2022 12:41:04 +0000 (13:41 +0100)] 
doc: Fix markup

2 years agoenhance: Extract lock keep-alive thread to a manager class
Joel Rosdahl [Mon, 5 Dec 2022 19:50:58 +0000 (20:50 +0100)] 
enhance: Extract lock keep-alive thread to a manager class

Instead of running one keep-alive thread per lock, a long-lived LockFile
now lets a separate LongLivedLockFileManager object handle keep-alive
for several locks in a single thread.

2 years agoenhance: Add AtomicFile::flush method
Joel Rosdahl [Sat, 3 Dec 2022 12:33:33 +0000 (13:33 +0100)] 
enhance: Add AtomicFile::flush method

2 years agochore: Refine ProgressBar value calculation
Joel Rosdahl [Sat, 26 Nov 2022 15:26:45 +0000 (16:26 +0100)] 
chore: Refine ProgressBar value calculation

2 years agochore: Improve description of --set-config
Joel Rosdahl [Sat, 26 Nov 2022 10:17:21 +0000 (11:17 +0100)] 
chore: Improve description of --set-config

2 years agorefactor: Make LockFile guard itself without a LockFileGuard
Joel Rosdahl [Sun, 13 Nov 2022 08:02:16 +0000 (09:02 +0100)] 
refactor: Make LockFile guard itself without a LockFileGuard

2 years agofix: Don't use copy of mutex/condition in long-lived lock thread
Joel Rosdahl [Wed, 23 Nov 2022 19:11:12 +0000 (20:11 +0100)] 
fix: Don't use copy of mutex/condition in long-lived lock thread

This was kind of due to a typo in
0babd33e84147e923a729ee07a3b85097ec8baa8. Since the LongLivedLockFile
class is not used yet, the bug does not affect any released code.

2 years agoenhance: Allow short-lived lock file to wait for long-lived
Joel Rosdahl [Thu, 10 Nov 2022 15:37:08 +0000 (16:37 +0100)] 
enhance: Allow short-lived lock file to wait for long-lived

2 years agochore: Add discussions badge
Joel Rosdahl [Thu, 24 Nov 2022 19:49:34 +0000 (20:49 +0100)] 
chore: Add discussions badge

2 years agodoc: Fix spelling of potentially
Joel Rosdahl [Mon, 21 Nov 2022 19:55:03 +0000 (20:55 +0100)] 
doc: Fix spelling of potentially

2 years agorefactor: Improve FileRecompressor to take a stat
Joel Rosdahl [Thu, 10 Nov 2022 09:07:33 +0000 (10:07 +0100)] 
refactor: Improve FileRecompressor to take a stat

This avoids extra stats in some scenarios.

2 years agorefactor: Remove CacheFile, using Stat with path member instead
Joel Rosdahl [Thu, 10 Nov 2022 08:38:37 +0000 (09:38 +0100)] 
refactor: Remove CacheFile, using Stat with path member instead

2 years agoenhance: Remember path in Stat
Joel Rosdahl [Thu, 10 Nov 2022 08:03:08 +0000 (09:03 +0100)] 
enhance: Remember path in Stat

2 years agoenhance: Only keep atime if needed
Joel Rosdahl [Thu, 10 Nov 2022 09:15:12 +0000 (10:15 +0100)] 
enhance: Only keep atime if needed

- For the --recompress case, only reset timestamps if mtime has changed
  since local cache LRU cleanup always uses mtime.
- For the --trim-dir/--trim-recompress case, always reset timestamps
  since atime may be used for LRU cleanup.

2 years agofeat: Add --trim-recompress and --trim-recompress-threads
Joel Rosdahl [Tue, 8 Nov 2022 07:48:07 +0000 (08:48 +0100)] 
feat: Add --trim-recompress and --trim-recompress-threads

Note: Reading the header to check the current compression level affects
atime, so we need to restore atime even when recompression is not
performed.

2 years agorefactor: Extract file recompression code to a class
Joel Rosdahl [Mon, 7 Nov 2022 20:46:25 +0000 (21:46 +0100)] 
refactor: Extract file recompression code to a class

2 years agoenhance: Add Util::format_human_readable_diff
Joel Rosdahl [Mon, 14 Nov 2022 08:55:09 +0000 (09:55 +0100)] 
enhance: Add Util::format_human_readable_diff

2 years agofeat: Improve Util::format_human_readable_size for small sizes
Joel Rosdahl [Mon, 7 Nov 2022 20:04:01 +0000 (21:04 +0100)] 
feat: Improve Util::format_human_readable_size for small sizes

2 years agofeat: Add --recompress-threads option
Joel Rosdahl [Mon, 7 Nov 2022 19:22:19 +0000 (20:22 +0100)] 
feat: Add --recompress-threads option

2 years agofix: Fix edge case where a non-temporal identifier is misidentified (#1227)
Erik Flodin [Sun, 27 Nov 2022 20:32:36 +0000 (21:32 +0100)] 
fix: Fix edge case where a non-temporal identifier is misidentified (#1227)

If a non-temporal identifier, that ends with a temporal macro, happens
to be at the end of the buffer with the temporal suffix starting on the
avx boundary, then it would be incorrectly classified as a temporal
macro. This since the helper function lacks the context to see that the
data before the match is something that invalidates the match.

2 years agochore: Update NEWS v4.7.4
Joel Rosdahl [Mon, 21 Nov 2022 18:53:32 +0000 (19:53 +0100)] 
chore: Update NEWS

2 years agochore: Fix typo
Joel Rosdahl [Sun, 20 Nov 2022 21:04:14 +0000 (22:04 +0100)] 
chore: Fix typo

2 years agobump: Upgrade to hiredis 1.1.0
Joel Rosdahl [Sun, 20 Nov 2022 19:46:16 +0000 (20:46 +0100)] 
bump: Upgrade to hiredis 1.1.0

2 years agofix: Avoid race condition in inode cache for quick updates
Joel Rosdahl [Thu, 17 Nov 2022 20:31:58 +0000 (21:31 +0100)] 
fix: Avoid race condition in inode cache for quick updates

The inode cache has a race condition that consists of these events:

1. A file is written with content C1, size S and timestamp (ctime/mtime)
   T.
2. Ccache hashes the file content and asks the inode cache to store the
   digest with a hash of S and T (and some other data) as the key.
3. The file is quickly thereafter written with content C2 without
   changing size S and timestamp T. The timestamp is not updated since
   the file writes are made within a time interval smaller than the
   granularity of the clock used for file system timestamps. At the time
   of writing, a common granularity on a Linux system is 0.004 s (250
   Hz).
4. The inode cache is asked for the file digest and the inode cache
   delivers a digest of C1 even though the file's content is C2.

To avoid the race condition, the inode cache now only caches inodes
whose timestamp was updated more than two seconds ago. This conservative
value is chosen since not all file systems have subsecond resolution.

Fixes #1215.

2 years agofix: Fall back to emulation for unsupported posix_fallocate (#1222)
Oleg Sidorkin [Mon, 14 Nov 2022 18:53:50 +0000 (21:53 +0300)] 
fix: Fall back to emulation for unsupported posix_fallocate (#1222)

posix_fallocate can return EINVAL if filesystem doesn't support it. Fall back to emulation in this case.

E.g. ZFS does so on FreeBSD (haven't tested with ZFS on linux).

This fixes Utill::fallocate unit tests on ZFS.

2 years agofix: Use $XDG_RUNTIME_DIR/ccache-tmp as the default temporary directory
Joel Rosdahl [Sun, 13 Nov 2022 13:43:35 +0000 (14:43 +0100)] 
fix: Use $XDG_RUNTIME_DIR/ccache-tmp as the default temporary directory

See discussion in #1221.

2 years agotest: Test TimePoint::nsec_decimal_part
Joel Rosdahl [Thu, 10 Nov 2022 15:28:08 +0000 (16:28 +0100)] 
test: Test TimePoint::nsec_decimal_part

2 years agofix: Fix bug in Duration arithmetic operators
Joel Rosdahl [Thu, 10 Nov 2022 15:29:25 +0000 (16:29 +0100)] 
fix: Fix bug in Duration arithmetic operators

The bug only affected LongLivedLockFile, which is not used yet.

2 years agoperf: Optimize util::write_file for empty data
Joel Rosdahl [Sun, 13 Nov 2022 08:48:10 +0000 (09:48 +0100)] 
perf: Optimize util::write_file for empty data

2 years agofix: Do not create /run directory on systems that don't have it (#1221)
Oleg Sidorkin [Sun, 13 Nov 2022 15:34:30 +0000 (18:34 +0300)] 
fix: Do not create /run directory on systems that don't have it (#1221)

2 years agodoc: Don't mention removed compiler type "pump"
Joel Rosdahl [Fri, 11 Nov 2022 21:50:06 +0000 (22:50 +0100)] 
doc: Don't mention removed compiler type "pump"

The implementation was removed in
2044fea84b86001b2976ecde946d3d6d0e88ec0a.

2 years agodoc: Add hint about using -fno-pch-timestamp for PCH with Clang
Joel Rosdahl [Fri, 11 Nov 2022 20:03:14 +0000 (21:03 +0100)] 
doc: Add hint about using -fno-pch-timestamp for PCH with Clang

2 years agodoc: Improve description of header file handling after 24cfb7998c27
Joel Rosdahl [Fri, 11 Nov 2022 19:53:09 +0000 (20:53 +0100)] 
doc: Improve description of header file handling after 24cfb7998c27

2 years agofix: Don't consider temporary files incompressible
Joel Rosdahl [Thu, 10 Nov 2022 10:17:26 +0000 (11:17 +0100)] 
fix: Don't consider temporary files incompressible

2 years agofix: Properly wait for recompression jobs if there is no f subdir
Joel Rosdahl [Thu, 10 Nov 2022 09:54:56 +0000 (10:54 +0100)] 
fix: Properly wait for recompression jobs if there is no f subdir

2 years agoenhance: Make subsequent calls to ThreadPool::shut_down NOPs
Joel Rosdahl [Thu, 10 Nov 2022 09:54:09 +0000 (10:54 +0100)] 
enhance: Make subsequent calls to ThreadPool::shut_down NOPs

2 years agodoc: Remove superfluous right parenthesis
Joel Rosdahl [Thu, 10 Nov 2022 10:11:13 +0000 (11:11 +0100)] 
doc: Remove superfluous right parenthesis

2 years agorefactor: Avoid changing loop variable in body of for loop
Joel Rosdahl [Wed, 9 Nov 2022 20:06:05 +0000 (21:06 +0100)] 
refactor: Avoid changing loop variable in body of for loop

This is to please CodeQL's "For loop variable changed in body" check.

2 years agorefactor: Remove empty if clause
Joel Rosdahl [Wed, 9 Nov 2022 20:02:19 +0000 (21:02 +0100)] 
refactor: Remove empty if clause

This is to please CodeQL's "Futile condition" check.

2 years agofix: Avoid duplicate magic header in --inspect
Joel Rosdahl [Tue, 8 Nov 2022 20:44:17 +0000 (21:44 +0100)] 
fix: Avoid duplicate magic header in --inspect

2 years agochore: Sort file list
Joel Rosdahl [Mon, 7 Nov 2022 20:11:36 +0000 (21:11 +0100)] 
chore: Sort file list