Browse Source

Update submitting bug reports, improve collect-info (#1598)

pull/1603/head
trapexit 1 week ago
committed by GitHub
parent
commit
72fb6e4aba
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 60
      .github/ISSUE_TEMPLATE/bug_report.md
  2. 4
      mkdocs/docs/support.md
  3. 23
      src/mergerfs_api.cpp
  4. 10
      src/mergerfs_api.hpp
  5. 89
      src/mergerfs_collect_info.cpp

60
.github/ISSUE_TEMPLATE/bug_report.md

@ -7,22 +7,31 @@ assignees: ''
---
See also https://trapexit.github.io/mergerfs/latest/support
**Describe the bug**
A clear and concise description of the unexpected behavior.
**Please be sure to use latest release of mergerfs to ensure the issue still exists. Not your distro's latest but the latest official release.**
**Please be sure to use latest release of mergerfs to ensure the issue
still exists. Not your distro's latest but the latest official
release. Support will NOT be provided for old versions.**
The master branch is **not** to be considered production ready. Feel free to file bug reports but do so indicating clearly that you are testing unreleased code.
The `master` branch is **not** to be considered production ready. Feel
free to file bug reports but do so indicating clearly that you are
testing unreleased code.
**To Reproduce**
Steps to reproduce the behavior. List **all** steps to reproduce. **All** settings.
Provide steps to reproduce the behavior. List **all** steps to
reproduce. **All** settings. The version of all software involved.
Please simplify the reproduction as much as possible.
- Unless it is dependenat on multiple branches, use a single branch
- Reproduce with standard tooling if possible (touch,truncate,rm,rmdir,ln,etc.) Having to install 3rd party software will make debugging more difficult.
* Unless it is dependenat on multiple branches, use a single branch
* Reproduce with standard tooling if possible
(touch,truncate,rm,rmdir,ln,etc.) Having to install 3rd party
software will make debugging more difficult.
**Expected behavior**
@ -30,19 +39,38 @@ Please simplify the reproduction as much as possible.
A clear and concise description of the expected behavior.
**Workarounds already tested**
Please list all workarounds attempted and why they were ruled out as
options.
**System information:**
- OS, kernel version: `uname -a`
- mergerfs version: `mergerfs -V`
- mergerfs settings
- List of drives, filesystems, & sizes:
- `df -h`
- `lsblk -f`
- A strace of the application having a problem:
- `strace -fvTtt -s 256 -o /tmp/app.strace.txt <cmd>`
- `strace -fvTtt -s 256 -o /tmp/app.strace.txt -p <appPID>`
- strace of mergerfs while app tried to do it's thing:
- `strace -fvTtt -s 256 -p <mergerfsPID> -o /tmp/mergerfs.strace.txt`
* Attach output from
[mergerfs.collect-info](https://trapexit.github.io/mergerfs/latest/tooling/#mergerfscollect-info)
tool.
* Alternatively:
* OS: `lsb_release -a`
* kernel version: `uname -a`
* mergerfs version: `mergerfs --version`
* mergerfs settings / arguments: from fstab, systemd unit, command
line, OMV plugin, etc.
* List of drives, filesystems, & sizes:
* `df -h`
* `lsblk -o NAME,FSTYPE,FSSIZE,SIZE,MOUNTPOINTS,RM,RO,ROTA`
* All information about the relevant paths and files: permissions,
ownership, etc.
* All information about the application making the requests:
version, uid/gid
* Is mergerfs running within a container or used with container
technologies?
* Are the client apps using mergerfs running in a container?
* A strace of the application having a problem:
* `strace -fvTtt -s 256 -o /tmp/app.strace.txt <cmd>`
* `strace -fvTtt -s 256 -o /tmp/app.strace.txt -p <appPID>`
* strace of mergerfs while app tried to do it's thing:
* `strace -fvTtt -s 256 -p <mergerfsPID> -o /tmp/mergerfs.strace.txt`
**Additional context**

4
mkdocs/docs/support.md

@ -38,8 +38,8 @@ directly.](mailto:support@spawn.link)**
* Are the client apps using mergerfs running in a container?
* A `strace` of the app having problems:
* `strace -fvTtt -s 256 -o /tmp/app.strace.txt <cmd>`
* A `strace` of mergerfs while the program is trying to do whatever it
is failing to do:
* A `strace` of mergerfs **while** the program is trying to do
whatever it is failing to do:
* `strace -fvTtt -s 256 -p <mergerfsPID> -o /tmp/mergerfs.strace.txt`
* **Precise** directions on replicating the issue. Do not leave
**anything** out.

23
src/mergerfs_api.cpp

@ -1,5 +1,7 @@
#include "mergerfs_api.hpp"
#include "fs_xattr.hpp"
#include "fs_exists.hpp"
#include "fs_lgetxattr.hpp"
#include "str.hpp"
@ -33,6 +35,27 @@ _lgetxattr(const std::string &input_path_,
return rv;
}
bool
mergerfs::api::is_mergerfs(const fs::path &mountpoint_)
{
fs::path dot_mergerfs_filepath;
dot_mergerfs_filepath = mountpoint_ / ".mergerfs";
return fs::exists(dot_mergerfs_filepath);
}
int
mergerfs::api::get_kvs(const fs::path &mountpoint_,
std::map<std::string,std::string> *kvs_)
{
fs::path dot_mergerfs_filepath;
dot_mergerfs_filepath = mountpoint_ / ".mergerfs";
return fs::xattr::get(dot_mergerfs_filepath,kvs_);
}
int
mergerfs::api::allpaths(const std::string &input_path_,
std::vector<std::string> &output_paths_)

10
src/mergerfs_api.hpp

@ -1,5 +1,8 @@
#pragma once
#include "fs_path.hpp"
#include <map>
#include <string>
#include <vector>
@ -8,6 +11,13 @@ namespace mergerfs
{
namespace api
{
bool
is_mergerfs(const fs::path &path);
int
get_kvs(const fs::path &mountpoint,
std::map<std::string,std::string> *kvs);
int
basepath(const std::string &path,
std::string &basepath);

89
src/mergerfs_collect_info.cpp

@ -28,10 +28,9 @@ _write_str(const std::string &output_,
::fwrite(str_.c_str(),1,str_.size(),f);
}
template<typename ARGS>
static
void
_run(const ARGS &args_,
_run(const std::initializer_list<const char*> &args_,
const std::string &output_)
{
std::string hdr;
@ -69,13 +68,7 @@ static
void
_mounts(const std::string &output_)
{
auto args =
{
"cat",
"/proc/mounts"
};
::_run(args,output_);
::_run({"cat","/proc/mounts"},output_);
}
static
@ -93,8 +86,7 @@ _mount_point_stats(const std::string &output_)
mergerfs::api::allpaths(mount.dir.string(),allpaths);
for(const auto &path : allpaths)
{
auto args = {"stat",path.c_str()};
::_run(args,output_);
::_run({"stat",path.c_str()},output_);
}
}
}
@ -103,65 +95,74 @@ static
void
_mergerfs_version(const std::string &output_)
{
auto args =
::_run({"mergerfs","--version"},output_);
}
static
void
_mergerfs_settings(const std::string &output_)
{
"mergerfs",
"--version"
};
fs::MountVec mounts;
::_run(args,output_);
fs::mounts(mounts);
for(const auto &mount : mounts)
{
int rv;
std::map<std::string,std::string> kvs;
rv = mergerfs::api::get_kvs(mount.dir.string(),&kvs);
if(rv < 0)
continue;
std::string output_str;
output_str = fmt::format("=== {}/.mergerfs\n",mount.dir.string());
for(const auto &[k,v] : kvs)
output_str += fmt::format("{}={}\n",k,v);
output_str += "\n\n";
_write_str(output_,output_str);
}
}
static
void
_uname(const std::string &output_)
{
auto args =
{
"uname",
"-a"
};
::_run(args,output_);
::_run({"uname","-a"},output_);
}
static
void
_lsb_release(const std::string &output_)
{
auto args =
{
"lsb_release",
"-a"
};
::_run(args,output_);
::_run({"lsb_release","-a"},output_);
}
static
void
_df(const std::string &output_)
{
auto args =
{
"df",
"-h"
};
::_run(args,output_);
::_run({"df","-h"},output_);
}
static
void
_fstab(const std::string &output_)
{
auto args =
{
"cat",
"/etc/fstab"
};
::_run({"cat","/etc/fstab"},output_);
}
::_run(args,output_);
static
void
_software_versions(const std::string &output_)
{
::_run({"docker","--version"},output_);
::_run({"docker","compose","--version"},output_);
::_run({"podman","--version"},output_);
::_run({"podman","compose","--version"},output_);
::_run({"smbd","--version"},output_);
}
@ -195,7 +196,9 @@ mergerfs::collect_info::main(int argc_,
::_lsblk(output_filepath);
::_mounts(output_filepath);
::_mount_point_stats(output_filepath);
::_mergerfs_settings(output_filepath);
::_fstab(output_filepath);
::_software_versions(output_filepath);
fmt::print("* Upload the following file to your"
" GitHub ticket or put on https://pastebin.com"

Loading…
Cancel
Save