Skip to content

Integrate out of tree development of watchtower#104

Merged
theyoyojo merged 27 commits into
masterfrom
watchtower
May 9, 2024
Merged

Integrate out of tree development of watchtower#104
theyoyojo merged 27 commits into
masterfrom
watchtower

Conversation

@charliemirabile

Copy link
Copy Markdown
Contributor

Several useful programs were developed in an different repository. This merge brings them and their full history into the monorepo. All of the commits have been rewritten to include the watchtower prefix, and to move their contents into the watchtower/ subdirectory, but are otherwise unaltered. A trailer is included with the original upstream sha hash.

charliemirabile and others added 27 commits May 9, 2024 10:56
Signed-off-by: Joel Savitz <jsavitz@redhat.com>
Upstream-commit: f2d00d8ae6669a3ad1c0abee58c32ff6670c87ed
Signed-off-by: Joel Savitz <jsavitz@redhat.com>
Upstream-commit: 083f7a46cf526b0d75dda5e5126b6e538102fb6b
Signed-off-by: Joel Savitz <jsavitz@redhat.com>
Upstream-commit: 04a2db0b15b123953d02e1ba04e64b74d313d7f2
Signed-off-by: Joel Savitz <jsavitz@redhat.com>
Upstream-commit: 768850d5e059d0d84bf820f2f2e47e1eec9313ae
Signed-off-by: Joel Savitz <jsavitz@redhat.com>
Upstream-commit: 98a35c307ffa00f74c90299d89a6cb1e6b8027a9
Upstream-commit: 11a9e8b6c5274e9aa088082f48bad267a5e728a6
Upstream-commit: 270698245fe3778ca4e320bd0d14023fa5e8d355
Signed-off-by: Joel Savitz <jsavitz@redhat.com>
Upstream-commit: f96c5784357ab341904d99a22cbebc8b356a37ad
This silences warning about it being an unused variable
since we aren't using it in either program.

Upstream-commit: 3e76658cdbc1f97d874ee2c8b69e1ad60031c80a
Watch uses inotify instead of timerfd. The old header was clearly
a result of copy paste.

Upstream-commit: 409a2377be9534bed80c520a621289f3f9d699d1
added a makefile that compiles both programs

Upstream-commit: 6723f19092bf2590716ed4099bf7b41e4c85e6e0
Upstream-commit: 90548bd527a8c742ce75d7cf6686df3082d472db
Upstream-commit: 4aa66f26f961d4b03f44542ff2ee8d226a21debc
using fread and relying on libc to use a suitably large buffer when trying
to read from the inotifyfd doesn't work on musl which tries to cleverly
use `readv` in its stdio implementation to avoid a copy within userspace.

We can just avoid that by invoking `read` directly and implementing our
own buffering logic that walks through the returned data before asking
the kernel for more.

Upstream-commit: 56d8ce565932f326874b9e73e783ff3e8d3aa07c
We don't need to watch more than on directory. If we really wanted
to do that, we could just spawn more than one of these programs.

Upstream-commit: e4e97688d8cb3bb1abe5af7ee39b23c0386c8082
We don't really care about their exit status, and if they take
a long time to run, we might miss events on our file descriptor.

Upstream-commit: def18c38d4b279e396cda41f7063c6e548c5cc78
These two didn't need to be a single if statment. Combining
them made the code harder to follow, and the error message less
specific.

Upstream-commit: e566b3e668f3814e908f7f021710cb634bffb4d9
we don't need the variable named now at all, it just makes things
more confusing, and needing to update it in two places is not DRY.

Upstream-commit: 444df49a3267920dc3739cf7aec54045561327c4
We can just spawn more than one of these programs if we
want to wait for more than one timestamp. Removes the
precondition that the timestamps are sorted too.

Upstream-commit: 5ef126898607be7ef9b69be8a6f72251a0560812
Since there is only one timestamp, we can just exec the
program in the main pid when the time passes.

Upstream-commit: 517728b7b13766c60ce5ebadfd0b3792fd469f68
Since intmax_t and time_t are actually probably both signed 64 bit ints
the cast isn't enough to catch range errors. We also need to check if
strtoimax returned a max or min value, and if it did, if it set errno.

Upstream-commit: 12217fd98d0892d6d43924f792f3cc947c0ee276
Upstream-commit: 3247d9e97299cbc3ac55f0757e1f4a94b7fafecb
Inspired by the kernel one, but with the modern line limit of 100
and some cruft like the kernel specific list of `for-each` macros
removed.

Only a few tweaks needed to bring the code into compliance.

Upstream-commit: e9edcaeb8cbf1e8cd14d40a95b7a09f03d9f8a0b
now that we only take one timestamp, we can allow more than just
one argument afterwards and forward subsequent values after the
script name as its arguments.

Upstream-commit: 98175aa00b5611b59a9160556344e506d19d29dc
watch conflicts with a common builtin command, and `due` makes
less sense when it only takes one timestamp.

Upstream-commit: 44b82b3302285914165a8ae2bf2d51488a382cbf
The switch statement lacked a default case,
so add one that simply breaks. No functional change.

Signed-off-by: Joel Savitz <jsavitz@redhat.com>

@theyoyojo theyoyojo left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice

image

@theyoyojo theyoyojo merged commit 153afcd into master May 9, 2024
@theyoyojo theyoyojo deleted the watchtower branch May 9, 2024 16:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants