- List tarball contents prior to extraction to improve robustness
- Plug some memory leaks
- Print errors to stderr instead of stdout
Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
Instead of extracting to a tmp folder, just tar `tf` it first. This
keeps extracting to the proper locations trivial, at the cost of
decompression the content twice.
We extract the tarball to a temporary file, before actually allowing
gdb to use this file. This allows us to make sure that gdb doesn't
see the file if it is corrupt. Only if tar exceeds, we rename() the
temp result into the actual needed file. If tar fails, we throw away
the file.
With socket activation, we can now select() and time out before accept()
and exit, releasing all resource we used back to the system.
The default timeout is set for 10 minutes. If no more connections
arrive, the daemon exits.
Socket activation is done through the clr_debug_daemon.socket unit, which
the clr_debug_fuse service requires, so this should be extra robust when
starting up.
The daemon ignores stat() requests for trash that gnome sends when it
sees the fuse system mounted, and returns the underlying stat() for
the root node instead of a remote value, because there is no value
in fetching this info over curl.
After closer inspection, I've determined that prior to this commit,
clr_debug_prepare was behaving properly with respect to the handling of
symlinks in debuginfo packages. Reverting this commit fixes the issue.
Details:
- Symlinks under /usr/lib/debug/.build-id that are not broken should be
unsymlinked so that the actual debuginfo is added to the automatic
debuginfo tarballs. In the debuginfo packages, these files have a
.debug extension and point to files under /usr/lib/debug/usr.
- Symlinks under /usr/lib/debug/.build-id that *are* broken cannot be
unsymlinked, and therefore, tar should not follow these symlinks,
because fatal errors (and empty tarballs) are the result. These
symlinks lack the .debug extension and point to the corresponding
libraries or binaries under /usr when exposed via clr_debug_fuse. So it
is correct for the symlinks to be broken when packaged by
clr_debug_prepare, since they point to non-debuginfo files, and the
debuginfo.raw directory tree only contains debuginfo content.
This reverts commit 7dcddfd0ca8f5539ef34028a1c680f6e82dcf246.
This release fixes a build issue when not passing -Wl,--copy-dt-needed-entries
to the compiler.
Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
For the regular Clear Linux build, the -lsystemd option was not needed at link
time due to -Wl,--copy-dt-needed-entries being used. Without that option
though, the linking of clr_debug_daemon will fail.
Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
Make /var/cache/debuginfo and its contents owned by dgbinfo. Create
the directories as this user, and switch to run as this user.
Signed-off-by: Icarus Sparry <icarus.w.sparry@intel.com>
We trigger redownloads from the server if the timestamp of
downloaded tar files is too new. An easy way around this issue
is to request the timestamp from the server instead of using
the download time. A `touch` of the tar then assures that
the downloaded file has the same timestamp as the server has.
Previously nc_copy_file would return true regardless of a source read
error, flagged in analysis. Ensure we bypass the set of ret to true and
return the correct value in all instances.
Signed-off-by: Ikey Doherty <michael.i.doherty@intel.com>
This particular assignment is never used, as if this path fails, we go to
the thread end. We then reassign prefix after we split the input string.
Signed-off-by: Ikey Doherty <michael.i.doherty@intel.com>
The signature was incorrect for inserting buckets, as we used an int, not
a boolean. Another issue resolved with this change is the potential
dereferencing of a null pointer by not having checked first if item was
NULL when setting the next pointer.
Signed-off-by: Ikey Doherty <michael.i.doherty@intel.com>
Adds a 30second connection timeout, and a low bandwith timeout
value (at 1kb/sec over 30 seconds) where the attempt will fail.
This provides some feedback to users that network issues are
preventing debug info from being loaded.