diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index a7d85f35..3cb728ba 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.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 ` - - `strace -fvTtt -s 256 -o /tmp/app.strace.txt -p ` - - strace of mergerfs while app tried to do it's thing: - - `strace -fvTtt -s 256 -p -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 ` + * `strace -fvTtt -s 256 -o /tmp/app.strace.txt -p ` + * strace of mergerfs while app tried to do it's thing: + * `strace -fvTtt -s 256 -p -o /tmp/mergerfs.strace.txt` **Additional context** diff --git a/mkdocs/docs/support.md b/mkdocs/docs/support.md index 89645888..8d9bd693 100644 --- a/mkdocs/docs/support.md +++ b/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 ` -* 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 -o /tmp/mergerfs.strace.txt` * **Precise** directions on replicating the issue. Do not leave **anything** out. diff --git a/src/mergerfs_api.cpp b/src/mergerfs_api.cpp index fa6dafce..0d880548 100644 --- a/src/mergerfs_api.cpp +++ b/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 *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 &output_paths_) diff --git a/src/mergerfs_api.hpp b/src/mergerfs_api.hpp index a1339b24..d8ce6d5f 100644 --- a/src/mergerfs_api.hpp +++ b/src/mergerfs_api.hpp @@ -1,5 +1,8 @@ #pragma once +#include "fs_path.hpp" + +#include #include #include @@ -8,6 +11,13 @@ namespace mergerfs { namespace api { + bool + is_mergerfs(const fs::path &path); + + int + get_kvs(const fs::path &mountpoint, + std::map *kvs); + int basepath(const std::string &path, std::string &basepath); diff --git a/src/mergerfs_collect_info.cpp b/src/mergerfs_collect_info.cpp index 4b5ccc6d..17c275d8 100644 --- a/src/mergerfs_collect_info.cpp +++ b/src/mergerfs_collect_info.cpp @@ -28,11 +28,10 @@ _write_str(const std::string &output_, ::fwrite(str_.c_str(),1,str_.size(),f); } -template static void -_run(const ARGS &args_, - const std::string &output_) +_run(const std::initializer_list &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_) +{ + fs::MountVec mounts; + + fs::mounts(mounts); + + for(const auto &mount : mounts) { - "mergerfs", - "--version" - }; + int rv; + std::map kvs; - ::_run(args,output_); + 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"