From 0eae53c6fe2c5dc9c382d45fabbb515f65a3d32f Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Sat, 20 Aug 2022 17:01:49 +0200 Subject: Cargo.lock: Rebuild with Rust 1.59.0 $ rustc --version rustc 1.59.0 (9d1b2106e 2022-02-23) --- Cargo.lock | 130 +++++++++++++++++++++++++++++++------------------------------ 1 file changed, 66 insertions(+), 64 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index c6659c1..e2bbc97 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,210 +1,212 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + [[package]] name = "block" version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d8c1fef690941d3e7788d328517591fecc684c084084702d6ff1641e993699a" [[package]] name = "clipboard" version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "811169a9ffda99ed1841a6db3c48cffbab9a9101376f77fee3c14a7581ab933d" dependencies = [ - "clipboard-win 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)", - "objc 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "objc-foundation 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "objc_id 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "x11 2.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "clipboard-win", + "objc", + "objc-foundation", + "objc_id", + "x11", ] [[package]] name = "clipboard-win" version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "238830bd83336a8620cbc1d6edf6b9222f45a2c52d02c164348fb6b466277b21" dependencies = [ - "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "user32-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", - "windows-error 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "kernel32-sys", + "user32-sys", + "winapi", + "windows-error", ] [[package]] name = "gag" version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c606f5c0da18075916377e73de8aec7c140e1b6110a3cf26ae1f47873529b47e" dependencies = [ - "libc 0.2.15 (registry+https://github.com/rust-lang/crates.io-index)", - "tempfile 2.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "libc", + "tempfile", ] [[package]] name = "kernel32-sys" version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" dependencies = [ - "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi", + "winapi-build", ] [[package]] name = "libc" version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23e3757828fa702a20072c37ff47938e9dd331b92fac6e223d26d4b7a55f7ee2" [[package]] name = "malloc_buf" version = "0.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62bb907fe88d54d8d9ce32a3cceab4218ed2f6b7d35617cafe9adf84e43919cb" dependencies = [ - "libc 0.2.15 (registry+https://github.com/rust-lang/crates.io-index)", + "libc", ] [[package]] name = "objc" version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c9311aa5acd7bee14476afa0f0557f564e9d0d61218a8b833d9b1f871fa5fba" dependencies = [ - "malloc_buf 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "malloc_buf", ] [[package]] name = "objc-foundation" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1add1b659e36c9607c7aab864a76c7a4c2760cd0cd2e120f3fb8b952c7e22bf9" dependencies = [ - "block 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "objc 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "objc_id 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "block", + "objc", + "objc_id", ] [[package]] name = "objc_id" version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e4730aa1c64d722db45f7ccc4113a3e2c465d018de6db4d3e7dfe031e8c8a297" dependencies = [ - "objc 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "objc", ] [[package]] name = "passextract" version = "0.4.0" dependencies = [ - "clipboard 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "rustty 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", + "clipboard", + "rustty", ] [[package]] name = "pkg-config" version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8cee804ecc7eaf201a4a207241472cc870e825206f6c031e3ee2a72fa425f2fa" [[package]] name = "rand" version = "0.3.14" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2791d88c6defac799c3f20d74f094ca33b9332612d9aef9078519c82e4fe04a5" dependencies = [ - "libc 0.2.15 (registry+https://github.com/rust-lang/crates.io-index)", + "libc", ] [[package]] name = "rustc_version" version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c5f5376ea5e30ce23c03eb77cbe4962b988deead10910c372b226388b594c084" dependencies = [ - "semver 0.1.20 (registry+https://github.com/rust-lang/crates.io-index)", + "semver", ] [[package]] name = "rustty" version = "0.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "79f6dcee0d7566faf07bc34682cae87115e93aa2dd9a29c7b8408ec898bd17b0" dependencies = [ - "gag 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.15 (registry+https://github.com/rust-lang/crates.io-index)", - "term 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", + "gag", + "libc", + "term", ] [[package]] name = "semver" version = "0.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4f410fedcf71af0345d7607d246e7ad15faaadd49d240ee3b24e5dc21a820ac" [[package]] name = "tempfile" version = "2.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9270837a93bad1b1dac18fe67e786b3c960513af86231f6f4f57fddd594ff0c8" dependencies = [ - "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.15 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc_version 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", + "kernel32-sys", + "libc", + "rand", + "rustc_version", + "winapi", ] [[package]] name = "term" version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3deff8a2b3b6607d6d7cc32ac25c0b33709453ca9cceac006caac51e963cf94a" dependencies = [ - "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", + "kernel32-sys", + "winapi", ] [[package]] name = "user32-sys" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ef4711d107b21b410a3a974b1204d9accc8b10dad75d8324b5d755de1617d47" dependencies = [ - "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi", + "winapi-build", ] [[package]] name = "winapi" version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" [[package]] name = "winapi-build" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc" [[package]] name = "windows-error" version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dfa34b3180ad6b4fe63cbc4fb773da4a83c5b3db8db15789051a4785f2b43e58" dependencies = [ - "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", + "kernel32-sys", + "winapi", ] [[package]] name = "x11" version = "2.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfc828b6baf54ccdde44e0b5f16e035ab9c54f60a0f0c218fb5ddbc6ab38a2a9" dependencies = [ - "libc 0.2.15 (registry+https://github.com/rust-lang/crates.io-index)", - "pkg-config 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[metadata] -"checksum block 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "0d8c1fef690941d3e7788d328517591fecc684c084084702d6ff1641e993699a" -"checksum clipboard 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "811169a9ffda99ed1841a6db3c48cffbab9a9101376f77fee3c14a7581ab933d" -"checksum clipboard-win 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "238830bd83336a8620cbc1d6edf6b9222f45a2c52d02c164348fb6b466277b21" -"checksum gag 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "c606f5c0da18075916377e73de8aec7c140e1b6110a3cf26ae1f47873529b47e" -"checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" -"checksum libc 0.2.15 (registry+https://github.com/rust-lang/crates.io-index)" = "23e3757828fa702a20072c37ff47938e9dd331b92fac6e223d26d4b7a55f7ee2" -"checksum malloc_buf 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "62bb907fe88d54d8d9ce32a3cceab4218ed2f6b7d35617cafe9adf84e43919cb" -"checksum objc 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7c9311aa5acd7bee14476afa0f0557f564e9d0d61218a8b833d9b1f871fa5fba" -"checksum objc-foundation 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "1add1b659e36c9607c7aab864a76c7a4c2760cd0cd2e120f3fb8b952c7e22bf9" -"checksum objc_id 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e4730aa1c64d722db45f7ccc4113a3e2c465d018de6db4d3e7dfe031e8c8a297" -"checksum pkg-config 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "8cee804ecc7eaf201a4a207241472cc870e825206f6c031e3ee2a72fa425f2fa" -"checksum rand 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)" = "2791d88c6defac799c3f20d74f094ca33b9332612d9aef9078519c82e4fe04a5" -"checksum rustc_version 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "c5f5376ea5e30ce23c03eb77cbe4962b988deead10910c372b226388b594c084" -"checksum rustty 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)" = "79f6dcee0d7566faf07bc34682cae87115e93aa2dd9a29c7b8408ec898bd17b0" -"checksum semver 0.1.20 (registry+https://github.com/rust-lang/crates.io-index)" = "d4f410fedcf71af0345d7607d246e7ad15faaadd49d240ee3b24e5dc21a820ac" -"checksum tempfile 2.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "9270837a93bad1b1dac18fe67e786b3c960513af86231f6f4f57fddd594ff0c8" -"checksum term 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "3deff8a2b3b6607d6d7cc32ac25c0b33709453ca9cceac006caac51e963cf94a" -"checksum user32-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4ef4711d107b21b410a3a974b1204d9accc8b10dad75d8324b5d755de1617d47" -"checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" -"checksum winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc" -"checksum windows-error 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "dfa34b3180ad6b4fe63cbc4fb773da4a83c5b3db8db15789051a4785f2b43e58" -"checksum x11 2.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bfc828b6baf54ccdde44e0b5f16e035ab9c54f60a0f0c218fb5ddbc6ab38a2a9" + "libc", + "pkg-config", +] -- cgit v1.2.3 From c1f72865741868d094a53fa73ee9b8562202ab0a Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Sat, 20 Aug 2022 17:02:38 +0200 Subject: Spawn `pass` in order to support GnuPG 2 and Pinentry Previously, Passextract didn't work with GnuPG 2 because I was immediately collecting the output of `pass`. With GnuPG 1.4, the password prompt was like a conventional `read`-style password prompt. However, in GnuPG 2, the prompt is replaced with Pinentry. Pinentry interferes with capturing the output from Pass, such that Passextract exits immediately, without even prompting for a password. Instead of using `Command.output`, use `Command.spawn`. This allows GnuPG to work correctly and display a Pinentry prompt. We can then capture the standard output from the child process and parse it for the Passextract interface. --- src/main.rs | 31 +++++++++++++++++++++++++------ 1 file changed, 25 insertions(+), 6 deletions(-) diff --git a/src/main.rs b/src/main.rs index 47095b8..7701dd3 100644 --- a/src/main.rs +++ b/src/main.rs @@ -63,15 +63,34 @@ fn parse_options(filename: &str) -> Vec { push_option(&mut options, line.to_owned()); } } else { - let file = Command::new("pass") + let mut child = Command::new("pass") .arg("show") .arg(filename) - .output() - .expect("Error executing `pass`") - .stdout; + .stdout(std::process::Stdio::piped()) + .spawn() + .expect("Error executing `pass`"); - for line in String::from_utf8_lossy(&file).lines() { - push_option(&mut options, line.to_owned()); + child.wait().expect("Error waiting for `pass`"); + + let stdout = child.stdout.take().unwrap(); + + // let file = stdout; + // let stdout = child.stdout.unwrap(); + let file = io::BufReader::new(stdout); + + // let mut line = String::new(); + + // loop { + // let n_bytes = file.read_line(&mut line).unwrap(); + // if n_bytes == 0 { + // break; + // } + // + // push_option(&mut options, line.to_owned()); + // } + + for line in file.lines() { + push_option(&mut options, line.unwrap()); } } -- cgit v1.2.3 From 19f554358d19f2cf5f71478aebd1400aff907a79 Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Sat, 20 Aug 2022 18:10:34 +0200 Subject: parse_options: Clean up `Command.spawn` code * Remove old in-progress code * Remove `child.stdout.take()` call, which is suggested in https://doc.rust-lang.org/std/process/struct.Child.html#structfield.stdout but ended up not being necessary in this instance. --- src/main.rs | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/src/main.rs b/src/main.rs index 7701dd3..ac289cd 100644 --- a/src/main.rs +++ b/src/main.rs @@ -72,25 +72,11 @@ fn parse_options(filename: &str) -> Vec { child.wait().expect("Error waiting for `pass`"); - let stdout = child.stdout.take().unwrap(); - - // let file = stdout; - // let stdout = child.stdout.unwrap(); + let stdout = child.stdout.expect("No standard output"); let file = io::BufReader::new(stdout); - // let mut line = String::new(); - - // loop { - // let n_bytes = file.read_line(&mut line).unwrap(); - // if n_bytes == 0 { - // break; - // } - // - // push_option(&mut options, line.to_owned()); - // } - for line in file.lines() { - push_option(&mut options, line.unwrap()); + push_option(&mut options, line.expect("Error reading line")); } } -- cgit v1.2.3