Code Monkey home page Code Monkey logo

btrfsutil-rs's People

Contributors

agrover avatar cezarmathe avatar dependabot[bot] avatar nalexpear avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

btrfsutil-rs's Issues

Fix Subvolume permissions issues

The Subvolume struct should include the id, the filesystem root and the path.

Create two ways of getting a Subvolume:

  • one that requires the exact path of the subvolume(will not require CAP_SYS_ADMIN)
  • one that will retrieve the subvolume at a certain path(will require CAP_SYS_ADMIN)

Refactor all functions that require the path so that they do not call the C function every time.

Do a release?

btrfsutil-rs 0.2.0?

I'm currently relying on master but this prevents me from publishing to crates.io. I published to btrfsutil-fake to work around this, but would prefer to use the mainline.

Subvolume::path() only works on btrfs root filesystem

Calling btrfs_util_subvolume_path with path "/" only works if btrfs is the filesystem mounted at /. If I have a btrfs filesystem mounted at /mnt/btrfs (and some other filesystem type is mounted at /), the filesystem root that needs to be passed is /mnt/btrfs.

I think this means a Subvolume needs to have some way to remember its filesystem root.

"warning: the following packages contain code that will be rejected by a future version of Rust: btrfsutil v0.1"

btrfsutil 0.1.0 contains code that will become an error in the future, as reported to me by rustc 1.71.0:

$ cargo report future-incompatibilities --id 1 --package [email protected]
The following warnings were discovered during the build. These warnings are an
indication that the packages contain code that will become an error in a
future release of Rust. These warnings typically cover changes to close
soundness problems, unintended or undocumented behavior, or critical problems
that cannot be fixed in a backwards-compatible fashion, and are not expected
to be in wide use.

Each warning should contain a link for more information on what the warning
means and how to resolve it.


To solve this problem, you can try the following approaches:


- If the issue is not solved by updating the dependencies, a fix has to be
implemented by those dependencies. You can help with that by notifying the
maintainers of this problem (e.g. by creating a bug report) or by proposing a
fix to the maintainers (e.g. by creating a pull request):

  - [email protected]
  - Repository: https://github.com/cezarmathe/btrfsutil-rs
  - Detailed warning command: `cargo report future-incompatibilities --id 1 --package [email protected]`

- If waiting for an upstream fix is not an option, you can use the `[patch]`
section in `Cargo.toml` to use your own version of the dependency. For more
information, see:
https://doc.rust-lang.org/cargo/reference/overriding-dependencies.html#the-patch-section

The package `btrfsutil v0.1.0` currently triggers the following future incompatibility lints:
> warning: trailing semicolon in macro used in expression position
>    --> /home/josh/.cargo/registry/src/index.crates.io-6f17d22bba15001f/btrfsutil-0.1.0/src/error/glue.rs:88:44
>     |
> 88  |         panic!("Glue error: {}", $glue_err);
>     |                                            ^
>     |
>    ::: /home/josh/.cargo/registry/src/index.crates.io-6f17d22bba15001f/btrfsutil-0.1.0/src/error/lib.rs:138:23
>     |
> 138 |             Err(e) => glue_error!(GlueError::Utf8Error(e)),
>     |                       ------------------------------------ in this macro invocation
>     |
>     = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
>     = note: for more information, see issue #79813 <https://github.com/rust-lang/rust/issues/79813>
>     = note: `#[allow(semicolon_in_expressions_from_macros)]` on by default
>     = note: this warning originates in the macro `glue_error` (in Nightly builds, run with -Z macro-backtrace for more info)
>
> warning: trailing semicolon in macro used in expression position
>    --> /home/josh/.cargo/registry/src/index.crates.io-6f17d22bba15001f/btrfsutil-0.1.0/src/error/glue.rs:88:44
>     |
> 88  |         panic!("Glue error: {}", $glue_err);
>     |                                            ^
>     |
>    ::: /home/josh/.cargo/registry/src/index.crates.io-6f17d22bba15001f/btrfsutil-0.1.0/src/error/lib.rs:207:18
>     |
> 207 |             _ => glue_error!(GlueError::UnknownErrno(errno)),
>     |                  ------------------------------------------- in this macro invocation
>     |
>     = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
>     = note: for more information, see issue #79813 <https://github.com/rust-lang/rust/issues/79813>
>     = note: `#[allow(semicolon_in_expressions_from_macros)]` on by default
>     = note: this warning originates in the macro `glue_error` (in Nightly builds, run with -Z macro-backtrace for more info)
>
> warning: trailing semicolon in macro used in expression position
>   --> /home/josh/.cargo/registry/src/index.crates.io-6f17d22bba15001f/btrfsutil-0.1.0/src/error/glue.rs:88:44
>    |
> 88 |         panic!("Glue error: {}", $glue_err);
>    |                                            ^
>    |
>   ::: /home/josh/.cargo/registry/src/index.crates.io-6f17d22bba15001f/btrfsutil-0.1.0/src/common.rs:19:17
>    |
> 19 |         None => glue_error!(GlueError::BadPath(path)),
>    |                 ------------------------------------- in this macro invocation
>    |
>    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
>    = note: for more information, see issue #79813 <https://github.com/rust-lang/rust/issues/79813>
>    = note: `#[allow(semicolon_in_expressions_from_macros)]` on by default
>    = note: this warning originates in the macro `glue_error` (in Nightly builds, run with -Z macro-backtrace for more info)
>
> warning: trailing semicolon in macro used in expression position
>   --> /home/josh/.cargo/registry/src/index.crates.io-6f17d22bba15001f/btrfsutil-0.1.0/src/error/glue.rs:88:44
>    |
> 88 |         panic!("Glue error: {}", $glue_err);
>    |                                            ^
>    |
>   ::: /home/josh/.cargo/registry/src/index.crates.io-6f17d22bba15001f/btrfsutil-0.1.0/src/common.rs:23:19
>    |
> 23 |         Err(e) => glue_error!(GlueError::NulError(e)),
>    |                   ----------------------------------- in this macro invocation
>    |
>    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
>    = note: for more information, see issue #79813 <https://github.com/rust-lang/rust/issues/79813>
>    = note: `#[allow(semicolon_in_expressions_from_macros)]` on by default
>    = note: this warning originates in the macro `glue_error` (in Nightly builds, run with -Z macro-backtrace for more info)
>
> warning: trailing semicolon in macro used in expression position
>    --> /home/josh/.cargo/registry/src/index.crates.io-6f17d22bba15001f/btrfsutil-0.1.0/src/error/glue.rs:88:44
>     |
> 88  |         panic!("Glue error: {}", $glue_err);
>     |                                            ^
>     |
>    ::: /home/josh/.cargo/registry/src/index.crates.io-6f17d22bba15001f/btrfsutil-0.1.0/src/subvolume/subvol.rs:207:23
>     |
> 207 |             Err(e) => glue_error!(GlueError::Utf8Error(e)),
>     |                       ------------------------------------ in this macro invocation
>     |
>     = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
>     = note: for more information, see issue #79813 <https://github.com/rust-lang/rust/issues/79813>
>     = note: `#[allow(semicolon_in_expressions_from_macros)]` on by default
>     = note: this warning originates in the macro `glue_error` (in Nightly builds, run with -Z macro-backtrace for more info)
>
> warning: trailing semicolon in macro used in expression position
>    --> /home/josh/.cargo/registry/src/index.crates.io-6f17d22bba15001f/btrfsutil-0.1.0/src/error/glue.rs:88:44
>     |
> 88  |         panic!("Glue error: {}", $glue_err);
>     |                                            ^
>     |
>    ::: /home/josh/.cargo/registry/src/index.crates.io-6f17d22bba15001f/btrfsutil-0.1.0/src/subvolume/subvol_info.rs:146:26
>     |
> 146 |         let uuid: Uuid = handle_uuid!(&src.uuid);
>     |                          ----------------------- in this macro invocation
>     |
>     = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
>     = note: for more information, see issue #79813 <https://github.com/rust-lang/rust/issues/79813>
>     = note: `#[allow(semicolon_in_expressions_from_macros)]` on by default
>     = note: this warning originates in the macro `glue_error` which comes from the expansion of the macro `handle_uuid` (in Nightly builds, run with -Z macro-backtrace for more info)
>
> warning: trailing semicolon in macro used in expression position
>    --> /home/josh/.cargo/registry/src/index.crates.io-6f17d22bba15001f/btrfsutil-0.1.0/src/error/glue.rs:88:44
>     |
> 88  |         panic!("Glue error: {}", $glue_err);
>     |                                            ^
>     |
>    ::: /home/josh/.cargo/registry/src/index.crates.io-6f17d22bba15001f/btrfsutil-0.1.0/src/subvolume/subvol_info.rs:147:37
>     |
> 147 |         let parent_uuid_val: Uuid = handle_uuid!(&src.parent_uuid);
>     |                                     ------------------------------ in this macro invocation
>     |
>     = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
>     = note: for more information, see issue #79813 <https://github.com/rust-lang/rust/issues/79813>
>     = note: `#[allow(semicolon_in_expressions_from_macros)]` on by default
>     = note: this warning originates in the macro `glue_error` which comes from the expansion of the macro `handle_uuid` (in Nightly builds, run with -Z macro-backtrace for more info)
>
> warning: trailing semicolon in macro used in expression position
>    --> /home/josh/.cargo/registry/src/index.crates.io-6f17d22bba15001f/btrfsutil-0.1.0/src/error/glue.rs:88:44
>     |
> 88  |         panic!("Glue error: {}", $glue_err);
>     |                                            ^
>     |
>    ::: /home/josh/.cargo/registry/src/index.crates.io-6f17d22bba15001f/btrfsutil-0.1.0/src/subvolume/subvol_info.rs:148:39
>     |
> 148 |         let received_uuid_val: Uuid = handle_uuid!(&src.received_uuid);
>     |                                       -------------------------------- in this macro invocation
>     |
>     = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
>     = note: for more information, see issue #79813 <https://github.com/rust-lang/rust/issues/79813>
>     = note: `#[allow(semicolon_in_expressions_from_macros)]` on by default
>     = note: this warning originates in the macro `glue_error` which comes from the expansion of the macro `handle_uuid` (in Nightly builds, run with -Z macro-backtrace for more info)
>
> warning: trailing semicolon in macro used in expression position
>    --> /home/josh/.cargo/registry/src/index.crates.io-6f17d22bba15001f/btrfsutil-0.1.0/src/error/glue.rs:88:44
>     |
> 88  |         panic!("Glue error: {}", $glue_err);
>     |                                            ^
>     |
>    ::: /home/josh/.cargo/registry/src/index.crates.io-6f17d22bba15001f/btrfsutil-0.1.0/src/subvolume/subvol_info.rs:149:36
>     |
> 149 |         let ctime: NaiveDateTime = handle_timespec!(src.ctime);
>     |                                    --------------------------- in this macro invocation
>     |
>     = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
>     = note: for more information, see issue #79813 <https://github.com/rust-lang/rust/issues/79813>
>     = note: `#[allow(semicolon_in_expressions_from_macros)]` on by default
>     = note: this warning originates in the macro `glue_error` which comes from the expansion of the macro `handle_timespec` (in Nightly builds, run with -Z macro-backtrace for more info)
>
> warning: trailing semicolon in macro used in expression position
>    --> /home/josh/.cargo/registry/src/index.crates.io-6f17d22bba15001f/btrfsutil-0.1.0/src/error/glue.rs:88:44
>     |
> 88  |         panic!("Glue error: {}", $glue_err);
>     |                                            ^
>     |
>    ::: /home/josh/.cargo/registry/src/index.crates.io-6f17d22bba15001f/btrfsutil-0.1.0/src/subvolume/subvol_info.rs:150:36
>     |
> 150 |         let otime: NaiveDateTime = handle_timespec!(src.otime);
>     |                                    --------------------------- in this macro invocation
>     |
>     = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
>     = note: for more information, see issue #79813 <https://github.com/rust-lang/rust/issues/79813>
>     = note: `#[allow(semicolon_in_expressions_from_macros)]` on by default
>     = note: this warning originates in the macro `glue_error` which comes from the expansion of the macro `handle_timespec` (in Nightly builds, run with -Z macro-backtrace for more info)
>
> warning: trailing semicolon in macro used in expression position
>    --> /home/josh/.cargo/registry/src/index.crates.io-6f17d22bba15001f/btrfsutil-0.1.0/src/error/glue.rs:88:44
>     |
> 88  |         panic!("Glue error: {}", $glue_err);
>     |                                            ^
>     |
>    ::: /home/josh/.cargo/registry/src/index.crates.io-6f17d22bba15001f/btrfsutil-0.1.0/src/subvolume/subvol_info.rs:151:40
>     |
> 151 |         let stime_val: NaiveDateTime = handle_timespec!(src.stime);
>     |                                        --------------------------- in this macro invocation
>     |
>     = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
>     = note: for more information, see issue #79813 <https://github.com/rust-lang/rust/issues/79813>
>     = note: `#[allow(semicolon_in_expressions_from_macros)]` on by default
>     = note: this warning originates in the macro `glue_error` which comes from the expansion of the macro `handle_timespec` (in Nightly builds, run with -Z macro-backtrace for more info)
>
> warning: trailing semicolon in macro used in expression position
>    --> /home/josh/.cargo/registry/src/index.crates.io-6f17d22bba15001f/btrfsutil-0.1.0/src/error/glue.rs:88:44
>     |
> 88  |         panic!("Glue error: {}", $glue_err);
>     |                                            ^
>     |
>    ::: /home/josh/.cargo/registry/src/index.crates.io-6f17d22bba15001f/btrfsutil-0.1.0/src/subvolume/subvol_info.rs:152:40
>     |
> 152 |         let rtime_val: NaiveDateTime = handle_timespec!(src.rtime);
>     |                                        --------------------------- in this macro invocation
>     |
>     = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
>     = note: for more information, see issue #79813 <https://github.com/rust-lang/rust/issues/79813>
>     = note: `#[allow(semicolon_in_expressions_from_macros)]` on by default
>     = note: this warning originates in the macro `glue_error` which comes from the expansion of the macro `handle_timespec` (in Nightly builds, run with -Z macro-backtrace for more info)```

Async/await

I'm currently using your library for a personal project with heavy usage of async code, and I was looking around in the code when I noticed a comment about planned async/await support (subvol.rs line 229). Is there any estimate for when that will be implemented?

subvolume snapshot broken?

For some reason, I can't take a snapshot of a volume using Subvolume::snapshot. I keep getting a SearchFalied response no matter the path I provide as the destination. Here is the code I am using to take the snapshot:

Subvolume::get("/mnt/images/alpine")
  .unwrap()
  .snapshot("/mnt/containers/test/rootfs", None, None)?;

/mnt is a the root of a btrfs filesystem with a subvolume at images/alpine. When I try it using the btrfs command line, it works with no issue. Even when I call it using std::process::Command it works properly. Am I doing something wrong, or is it within the library?

Edit: I should also add that I am running the program as root, so permissions shouldn't be an issue?

Building examples fails

Hello,

I just cloned the repository and wanted to compile the examples like it's shown in the readme by using: cargo build --examples

   Compiling btrfsutil v0.1.0 (/tmp/btrfsutil-rs)
     Running `rustc --crate-name subvolume_iterator_info --edition=2018 examples/subvolume_iterator_info.rs --error-format=json --json=diagnostic-rendered-ansi --crate-type bin --emit=dep-info,link -Cembed-bitcode=no -C debuginfo=2 --cfg 'feature="default"' -C metadata=99493dc0e499a1f7 -C extra-filename=-99493dc0e499a1f7 --out-dir /tmp/btrfsutil-rs/target/debug/examples -C incremental=/tmp/btrfsutil-rs/target/debug/incremental -L dependency=/tmp/btrfsutil-rs/target/debug/deps --extern bitflags=/tmp/btrfsutil-rs/target/debug/deps/libbitflags-0cd415034ee648ca.rlib --extern btrfsutil=/tmp/btrfsutil-rs/target/debug/deps/libbtrfsutil-966ab251e35e1ce3.rlib --extern btrfsutil_sys=/tmp/btrfsutil-rs/target/debug/deps/libbtrfsutil_sys-71a95990b4d2e496.rlib --extern chrono=/tmp/btrfsutil-rs/target/debug/deps/libchrono-e2e17c2673c59046.rlib --extern libc=/tmp/btrfsutil-rs/target/debug/deps/liblibc-bb07417106e69ff9.rlib --extern libmount=/tmp/btrfsutil-rs/target/debug/deps/liblibmount-375cfedd7c41acff.rlib --extern loopdev=/tmp/btrfsutil-rs/target/debug/deps/libloopdev-644ecdbbd5c7ce20.rlib --extern nix=/tmp/btrfsutil-rs/target/debug/deps/libnix-a65400f06839ac2c.rlib --extern tempfile=/tmp/btrfsutil-rs/target/debug/deps/libtempfile-28cb05591749222e.rlib --extern thiserror=/tmp/btrfsutil-rs/target/debug/deps/libthiserror-bfaab245d3803832.rlib --extern uuid=/tmp/btrfsutil-rs/target/debug/deps/libuuid-959314128929bc1a.rlib`
error[E0599]: no function or associated item named `from_path` found for struct `btrfsutil::subvolume::Subvolume` in the current scope
 --> examples/subvolume_iterator_info.rs:7:34
  |
7 |     let root_subvol = Subvolume::from_path(Path::new("/")).unwrap();
  |                                  ^^^^^^^^^ function or associated item not found in `btrfsutil::subvolume::Subvolume`

error[E0599]: no method named `info` found for enum `std::result::Result<btrfsutil::subvolume::Subvolume, btrfsutil::error::LibError>` in the current scope
  --> examples/subvolume_iterator_info.rs:15:36
   |
15 |         println!("{:?}", subvolume.info().unwrap());
   |                                    ^^^^ method not found in `std::result::Result<btrfsutil::subvolume::Subvolume, btrfsutil::error::LibError>`

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0599`.
error: could not compile `btrfsutil`.

Caused by:
  process didn't exit successfully: `rustc --crate-name subvolume_iterator_info --edition=2018 examples/subvolume_iterator_info.rs --error-format=json --json=diagnostic-rendered-ansi --crate-type bin --emit=dep-info,link -Cembed-bitcode=no -C debuginfo=2 --cfg 'feature="default"' -C metadata=99493dc0e499a1f7 -C extra-filename=-99493dc0e499a1f7 --out-dir /tmp/btrfsutil-rs/target/debug/examples -C incremental=/tmp/btrfsutil-rs/target/debug/incremental -L dependency=/tmp/btrfsutil-rs/target/debug/deps --extern bitflags=/tmp/btrfsutil-rs/target/debug/deps/libbitflags-0cd415034ee648ca.rlib --extern btrfsutil=/tmp/btrfsutil-rs/target/debug/deps/libbtrfsutil-966ab251e35e1ce3.rlib --extern btrfsutil_sys=/tmp/btrfsutil-rs/target/debug/deps/libbtrfsutil_sys-71a95990b4d2e496.rlib --extern chrono=/tmp/btrfsutil-rs/target/debug/deps/libchrono-e2e17c2673c59046.rlib --extern libc=/tmp/btrfsutil-rs/target/debug/deps/liblibc-bb07417106e69ff9.rlib --extern libmount=/tmp/btrfsutil-rs/target/debug/deps/liblibmount-375cfedd7c41acff.rlib --extern loopdev=/tmp/btrfsutil-rs/target/debug/deps/libloopdev-644ecdbbd5c7ce20.rlib --extern nix=/tmp/btrfsutil-rs/target/debug/deps/libnix-a65400f06839ac2c.rlib --extern tempfile=/tmp/btrfsutil-rs/target/debug/deps/libtempfile-28cb05591749222e.rlib --extern thiserror=/tmp/btrfsutil-rs/target/debug/deps/libthiserror-bfaab245d3803832.rlib --extern uuid=/tmp/btrfsutil-rs/target/debug/deps/libuuid-959314128929bc1a.rlib` (exit code: 1)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.