Skip to content

Conversation

iceiix
Copy link
Owner

@iceiix iceiix commented Jul 30, 2022

https://github.com/aweinstock314/rust-clipboard has no releases since 2019, there are a bunch of open pull requests: https://github.com/aweinstock314/rust-clipboard/pulls - this lack of a newer clipboard is holding back xcb (though there is a pull request to update it: aweinstock314/rust-clipboard#89 - could alternatively switch to a git version) so https://github.com/iceiix/stevenarella/security/dependabot is reporting several alerts:

Screen Shot 2022-07-30 at 4 03 36 PM

Looking at the forks, https://github.com/ActuallyAllie/cli-clipboard is newer and has an updated xcb
Switch to use cli-clipboard to replace (rust-)clipboard
Update to use a fork of clipboard with an updated x11-clipboard in order to update xcb

@iceiix
Copy link
Owner Author

iceiix commented Jul 30, 2022

This may not completely fix the problem - allie-wake-up/cli-clipboard#13 (comment) is asking for a newer release of cli-clipboard for xcb > 1.0 (the git version has it, but last cargo release is 0.2.1 at the time of this writing (although https://github.com/ActuallyAllie/cli-clipboard/releases/ only goes up to 0.2.0)).

@iceiix
Copy link
Owner Author

iceiix commented Jul 30, 2022

Breaks the wasm build:

error[E0433]: failed to resolve: use of undeclared type `ClipboardContext`
[335](https://github.com/iceiix/stevenarella/runs/7594652869?check_suite_focus=true#step:5:336)
   --> /home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/cli-clipboard-0.2.1/src/lib.rs:123:19
[336](https://github.com/iceiix/stevenarella/runs/7594652869?check_suite_focus=true#step:5:337)
    |
[337](https://github.com/iceiix/stevenarella/runs/7594652869?check_suite_focus=true#step:5:338)
123 |     let mut ctx = ClipboardContext::new()?;
[338](https://github.com/iceiix/stevenarella/runs/7594652869?check_suite_focus=true#step:5:339)
    |                   ^^^^^^^^^^^^^^^^ use of undeclared type `ClipboardContext`
[339](https://github.com/iceiix/stevenarella/runs/7594652869?check_suite_focus=true#step:5:340)

[340](https://github.com/iceiix/stevenarella/runs/7594652869?check_suite_focus=true#step:5:341)
error[E0433]: failed to resolve: use of undeclared type `ClipboardContext`
[341](https://github.com/iceiix/stevenarella/runs/7594652869?check_suite_focus=true#step:5:342)
   --> /home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/cli-clipboard-0.2.1/src/lib.rs:144:19
[342](https://github.com/iceiix/stevenarella/runs/7594652869?check_suite_focus=true#step:5:343)
    |
[343](https://github.com/iceiix/stevenarella/runs/7594652869?check_suite_focus=true#step:5:344)
144 |     let mut ctx = ClipboardContext::new()?;
[344](https://github.com/iceiix/stevenarella/runs/7594652869?check_suite_focus=true#step:5:345)
    |                   ^^^^^^^^^^^^^^^^ use of undeclared type `ClipboardContext`
[345](https://github.com/iceiix/stevenarella/runs/7594652869?check_suite_focus=true#step:5:346)

[346](https://github.com/iceiix/stevenarella/runs/7594652869?check_suite_focus=true#step:5:347)
For more information about this error, try `rustc --explain E0433`.
[347](https://github.com/iceiix/stevenarella/runs/7594652869?check_suite_focus=true#step:5:348)
error: could not compile `cli-clipboard` due to 2 previous errors
[348](https://github.com/iceiix/stevenarella/runs/7594652869?check_suite_focus=true#step:5:349)
warning: build failed, waiting for other jobs to finish...
[349](https://github.com/iceiix/stevenarella/runs/7594652869?check_suite_focus=true#step:5:350)
error: build failed
[350](https://github.com/iceiix/stevenarella/runs/7594652869?check_suite_focus=true#step:5:351)
Error: Compiling your crate to WebAssembly failed

maybe better to switch to an updated fork of clipboard than to cli-clipboard?

@iceiix iceiix changed the title Replace clipboard with cli-clipboard Update clipboard->x11-clipboard->xcb Jul 31, 2022
@iceiix iceiix changed the title Update clipboard->x11-clipboard->xcb clipboard: update to fork updating x11-clipboard for xcb Jul 31, 2022
@iceiix iceiix merged commit 2e224a7 into master Jul 31, 2022
@iceiix iceiix deleted the cb branch July 31, 2022 00:11
@iceiix
Copy link
Owner Author

iceiix commented Jul 31, 2022

Note: another alternative to cli-clipboard is arboard: https://crates.io/crates/arboard
It looks well-maintained. A patch to use it:

--- a/src/ui/mod.rs
+++ b/src/ui/mod.rs
@@ -17,7 +17,7 @@ pub mod logo;
 use crate::format;
 use crate::render;
 #[cfg(not(target_arch = "wasm32"))]
-use clipboard::{ClipboardContext, ClipboardProvider};
+use arboard::Clipboard;
 use std::cell::{RefCell, RefMut};
 use std::rc::{Rc, Weak};
 use winit::event::VirtualKeyCode;
@@ -1550,8 +1550,8 @@ impl UIElement for TextBox {
             #[cfg(not(target_arch = "wasm32"))]
             (VirtualKeyCode::V, true) => {
                 if ctrl_pressed {
-                    let mut clipboard: ClipboardContext = ClipboardProvider::new().unwrap();
-                    if let Ok(text) = clipboard.get_contents() {
+                    let mut clipboard = Clipboard::new().unwrap();
+                    if let Ok(text) = clipboard.get_text() {
                         self.input.push_str(&text)
                     }
                 }

works on native, but has the same/similar problem as cli-clipboard (but not rust-clipboard) when compiling on wasm:

error[E0433]: failed to resolve: use of undeclared type `PlatformClipboard`
  --> /Users/admin/.cargo/registry/src/github.com-1ecc6299db9ec823/arboard-2.1.1/src/lib.rs:69:28
   |
69 |         Ok(Clipboard { platform: PlatformClipboard::new()? })
   |                                  ^^^^^^^^^^^^^^^^^ use of undeclared type `PlatformClipboard`

error[E0412]: cannot find type `PlatformClipboard` in this scope
  --> /Users/admin/.cargo/registry/src/github.com-1ecc6299db9ec823/arboard-2.1.1/src/lib.rs:63:23
   |
63 |     pub(crate) platform: PlatformClipboard,
   |                          ^^^^^^^^^^^^^^^^^ not found in this scope

so not using arboard for now (but ultimately, would like to use a properly supported clipboard project going forward instead of having to pin a git version, in order to more easily support updates, including from dependabot alerts).

benjaminedwardwebb added a commit to benjaminedwardwebb/dmenu-rs that referenced this pull request Oct 22, 2022
The rust-clipboard project's maintenance status is [unclear][1].

It pulls in an old version of [ruxt-xcb][2]. This old version has a
[security issue][3]. It also has a complex build that caused failures I
could not debug when building dmenu-rs with nix.

There is an [open PR][4] to rust-clipboard that updates the X11 and XCB
dependencies with a minimal changeset, resolving this issue.

This commit updates dmenu-rs's rust-clipboard dependency to point to the
fix in the open PR, located on the upgrade-x11 branch of xliiv's fork.

You can find similar discussion in an unrelated project [here][5].

[1]: aweinstock314/rust-clipboard#91
[2]: https://github.com/rust-x-bindings/rust-xcb/tree/v0.8.2
[3]: aweinstock314/rust-clipboard#90
[4]: aweinstock314/rust-clipboard#89
[5]: iceiix/stevenarella#701
benjaminedwardwebb added a commit to benjaminedwardwebb/dmenu-rs that referenced this pull request Nov 12, 2022
The rust-clipboard project's maintenance status is [unclear][1].

It pulls in an old version of [ruxt-xcb][2]. This old version has a
[security issue][3]. It also has a complex build that caused failures I
could not debug when building dmenu-rs with nix.

There is an [open PR][4] to rust-clipboard that updates the X11 and XCB
dependencies with a minimal changeset, resolving this issue.

This commit updates dmenu-rs's rust-clipboard dependency to point to the
fix in the open PR, located on the upgrade-x11 branch of xliiv's fork.

You can find similar discussion in an unrelated project [here][5].

[1]: aweinstock314/rust-clipboard#91
[2]: https://github.com/rust-x-bindings/rust-xcb/tree/v0.8.2
[3]: aweinstock314/rust-clipboard#90
[4]: aweinstock314/rust-clipboard#89
[5]: iceiix/stevenarella#701
benjaminedwardwebb added a commit to benjaminedwardwebb/dmenu-rs that referenced this pull request Nov 12, 2022
The rust-clipboard project's maintenance status is [unclear][1].

It pulls in an old version of [ruxt-xcb][2]. This old version has a
[security issue][3]. It also has a complex build that caused failures I
could not debug when building dmenu-rs with nix.

There is an [open PR][4] to rust-clipboard that updates the X11 and XCB
dependencies with a minimal changeset, resolving this issue.

This commit updates dmenu-rs's rust-clipboard dependency to point to the
fix in the open PR, located on the upgrade-x11 branch of xliiv's fork.

You can find similar discussion in an unrelated project [here][5].

[1]: aweinstock314/rust-clipboard#91
[2]: https://github.com/rust-x-bindings/rust-xcb/tree/v0.8.2
[3]: aweinstock314/rust-clipboard#90
[4]: aweinstock314/rust-clipboard#89
[5]: iceiix/stevenarella#701
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.

1 participant