profile
viewpoint

estk/log4rs 398

A highly configurable logging framework for Rust

a8m/pb 346

Console progress bar for Rust

env-logger-rs/env_logger 248

A logging implementation for `log` which is configured via an environment variable.

pyfisch/cbor 219

CBOR support for serde.

gnzlbg/jemallocator 200

Rust allocator using jemalloc as a backend

carllerche/syncbox 129

Concurrency utilities for Rust

kornelski/rust-security-framework 87

Bindings to the macOS Security.framework

rust-lang-nursery/unix-socket 51

Unix socket support for Rust

pull request commentrust-lang/rust

Relax promises about condition variable.

@bors r+ rollup

m-ou-se

comment created time in 22 minutes

issue commentsfackler/rust-postgres

Option to read config from environment variables?

While I wouldn't want this to happen by default, it seems potentially plausible to have a method on the Config type to do this - Config::new().load_from_env() or whatever.

vpzomtrrfrt

comment created time in 2 hours

pull request commentsfackler/r2d2

add #![forbid(unsafe_code)]

it also helps with analysers (e.g. cargo-geiger, see link in the commit-msg),

The existence of #![forbid(unsafe_code)] does not mean that a dependency does not contain unsafe code. Cargo passes --cap-lints=warn to rustc when building dependencies, which overrides the forbid.

rursprung

comment created time in 16 hours

created tagalexcrichton/openssl-src-rs

tag111.11.0+1.1.1h

Source code and logic to build OpenSSL from source

created time in 19 hours

release alexcrichton/openssl-src-rs

111.11.0+1.1.1h

released time in 19 hours

issue commentalexcrichton/openssl-src-rs

Supporting aarch64-apple-darwin

We already do a bit of munging for MUSL here: https://github.com/alexcrichton/openssl-src-rs/blob/master/src/lib.rs#L449, so this could follow that pattern.

shepmaster

comment created time in 21 hours

PR opened alexcrichton/openssl-src-rs

Reviewers
Bump to 1.1.1h
+2 -2

0 comment

2 changed files

pr created time in 21 hours

create barnchalexcrichton/openssl-src-rs

branch : 111h

created branch time in 21 hours

delete branch alexcrichton/openssl-src-rs

delete branch : 111f

delete time in 21 hours

create barnchalexcrichton/openssl-src-rs

branch : 111f

created branch time in 21 hours

push eventsfackler/rust-openssl

Steven Fackler

commit sha 7ef5e50e26fd21f292e536f68aa82e26bfaa163a

bump to 1.1.1f in CI

view details

push time in 21 hours

issue commentalexcrichton/openssl-src-rs

Supporting aarch64-apple-darwin

It feels kind of bad, but given that it's already shipping in Homebrew maybe not the worst option: https://github.com/openssl/openssl/pull/12369#issuecomment-683977255

shepmaster

comment created time in a day

pull request commentpalantir/conjure-rust

Fix path pattern that use wildcard.

That is, this logic should look for :.* and :.+ and then split the param on / and push each component separately in that case: https://github.com/palantir/conjure-rust-runtime/blob/master/conjure-runtime/src/send.rs#L270-L311.

tom-s-powell

comment created time in a day

delete branch palantir/conjure-rust-runtime

delete branch : excavator/bulldozer-oss

delete time in a day

push eventpalantir/conjure-rust-runtime

svc-excavator-bot

commit sha a84abd4a50bce7328b95008ab32594c97f41da26

Excavator: Render Bulldozer Bot config file

view details

Steven Fackler

commit sha 2ef5efdcb3914cb6f3ac0b05ef597d17f9dc5944

Merge pull request #30 from palantir/excavator/bulldozer-oss Excavator: Render Bulldozer Bot config file

view details

push time in a day

PR merged palantir/conjure-rust-runtime

Excavator: Render Bulldozer Bot config file no changelog
excavator is a bot for automating changes across repositories.

Changes produced by the excavator/bulldozer-oss check.

To enable or disable this check, please contact the maintainers of Excavator.

+3 -3

0 comment

1 changed file

svc-excavator-bot

pr closed time in a day

delete branch palantir/conjure-rust-runtime

delete branch : excavator/consistent-github-templates

delete time in a day

push eventpalantir/conjure-rust-runtime

svc-excavator-bot

commit sha c9514da13adc1cab0133587ca9431b36b552682c

Excavator: Ensure consistent PULL_REQUEST_TEMPLATE.md

view details

Steven Fackler

commit sha 586c57350a24e076b1228187014189a773d8d47e

Merge pull request #31 from palantir/excavator/consistent-github-templates Excavator: Ensure consistent PULL_REQUEST_TEMPLATE.md

view details

push time in a day

PR merged palantir/conjure-rust-runtime

Excavator: Ensure consistent PULL_REQUEST_TEMPLATE.md no changelog
excavator is a bot for automating changes across repositories.

Changes produced by the excavator/consistent-github-templates check.

To enable or disable this check, please contact the maintainers of Excavator.

+1 -1

0 comment

1 changed file

svc-excavator-bot

pr closed time in a day

pull request commentpalantir/conjure-rust

Fix path pattern that use wildcard.

Don't wildcard path patterns behave differently in that inline /s aren't escaped? It seems like we'd instead need to continue propagating them and update the downstream client to handle them.

tom-s-powell

comment created time in a day

issue commenttokio-rs/tokio

std::io::Error → tokio::io::Error conversion

Tokio's io::Error is std's io::Error: https://docs.rs/tokio/0.2.22/src/tokio/io/mod.rs.html#239.

jplatte

comment created time in a day

pull request commentsfackler/r2d2

add #![forbid(unsafe_code)]

If I want to add unsafe code later on, I would just remove the annotation - what exactly does this ensure?

rursprung

comment created time in a day

issue commenttokio-rs/tokio

stream: coordinating Tokio 1.0 with the availability of Stream in std

I don't know what the current thought is, but there was an idea that the futures crate could start transparently reexporting std's Stream when being built against a suitable version to avoid forcing a big migration.

carllerche

comment created time in 2 days

pull request commentrust-lang/rust

Stabilize slice_ptr_range.

@rfcbot fcp merge

m-ou-se

comment created time in 2 days

issue commentrust-lang/log

Idempotent logging initialization

The pointers would not be equal in the env-logger-in-test workflow. env-logger allocates a new logger each time init is called.

piegamesde

comment created time in 2 days

issue commentrust-lang/log

Idempotent logging initialization

How would the log crate determine if "the same" logger is being installed without modifying every single logging implementation?

piegamesde

comment created time in 2 days

pull request commentrust-lang/rust

add array::from_ref

I'm not really opposed, but why will const generics change the usefulness of this method?

lcnr

comment created time in 2 days

issue commentsfackler/rust-postgres

Implementing ToSql for rust variant enum and postgres_types::ToSql is not implemented for `u64`

Numeric is an arbitrarily precision fixed point type, not a 64 bit integer type.

glennpierce

comment created time in 2 days

pull request commentrust-lang/rust

make exp_m1 and ln_1p examples more representative of use

r? @rust-lang/docs

tspiteri

comment created time in 2 days

pull request commentsfackler/rust-postgres

Permit configuring the notice callback

Thanks!

benesch

comment created time in 3 days

push eventsfackler/rust-postgres

Nikhil Benesch

commit sha 4af6fcd911227f1d3cf0ea93d8d7ea0c34fb1195

Permit configuring the notice callback Right now the behavior is hardcoded to log any received notices at the info level. Add a `notice_callback` configuration option that permits installing an arbitrary callback to handle any received notices. As discussed in #588.

view details

Steven Fackler

commit sha eabcc286573c12621d04b2e237d772cb71cc4dd5

Merge pull request #655 from benesch/notice-callback Permit configuring the notice callback

view details

push time in 3 days

PR merged sfackler/rust-postgres

Permit configuring the notice callback

Right now the behavior is hardcoded to log any received notices at the info level. Add a notice_callback configuration option that permits installing an arbitrary callback to handle any received notices.

As discussed in #588.

+60 -8

4 comments

3 changed files

benesch

pr closed time in 3 days

issue closedrust-lang/rust

test code more or less identical to the main() hangs.

Currently, I'm trying to learn rust with exercism and I ran into the following situation which smells like a bug to me.

When I ran this code with: rustc src/lib.rs && time ./lib it finishes after 2 seconds, returning the right result. When I run the tests (next snippet) with: cargo test -- --ignored All tests succeed, apart from the last one, identical to main() There it crashes after say 120 seconds, whilst eating all my resources.

pub fn sum_of_multiples(limit: u32, factors: &[u32]) -> u32 {
    let mut sum:u32 = 0;
    let mut x:u32;
    let mut seen = Vec::new();
    for i in factors {
        x = 0;
        while x + i < limit {
            x = x + i;
            if seen.iter().any(|&j| j == x) {
                //println!("already seen {}", x);
            } else {
                seen.push(x);
                //println!("factor: {}", x);
                sum = sum + x;
                //println!("intermediate sum: {}", sum);
            }
        }
    }
    //println!("endsum: {}", sum);
    sum
}

pub fn main() {
    println!("{}", sum_of_multiples(10_000, &[2,3,5,7,11]));
    println!("should be: 39_614_537");
}
use sum_of_multiples::*;

#[test]
fn no_multiples_within_limit() {
    assert_eq!(0, sum_of_multiples(1, &[3, 5]))
}

#[test]
#[ignore]
fn one_factor_has_multiples_within_limit() {
    assert_eq!(3, sum_of_multiples(4, &[3, 5]))
}

#[test]
#[ignore]
fn more_than_one_multiple_within_limit() {
    assert_eq!(9, sum_of_multiples(7, &[3]))
}

#[test]
#[ignore]
fn more_than_one_factor_with_multiples_within_limit() {
    assert_eq!(23, sum_of_multiples(10, &[3, 5]))
}

#[test]
#[ignore]
fn each_multiple_is_only_counted_once() {
    assert_eq!(2318, sum_of_multiples(100, &[3, 5]))
}

#[test]
#[ignore]
fn a_much_larger_limit() {
    assert_eq!(233_168, sum_of_multiples(1000, &[3, 5]))
}

#[test]
#[ignore]
fn three_factors() {
    assert_eq!(51, sum_of_multiples(20, &[7, 13, 17]))
}

#[test]
#[ignore]
fn factors_not_relatively_prime() {
    assert_eq!(30, sum_of_multiples(15, &[4, 6]))
}

#[test]
#[ignore]
fn some_pairs_of_factors_relatively_prime_and_some_not() {
    assert_eq!(4419, sum_of_multiples(150, &[5, 6, 8]))
}

#[test]
#[ignore]
fn one_factor_is_a_multiple_of_another() {
    assert_eq!(275, sum_of_multiples(51, &[5, 25]))
}

#[test]
#[ignore]
fn much_larger_factors() {
    assert_eq!(2_203_160, sum_of_multiples(10_000, &[43, 47]))
}

#[test]
#[ignore]
fn all_numbers_are_multiples_of_1() {
    assert_eq!(4950, sum_of_multiples(100, &[1]))
}

#[test]
#[ignore]
fn no_factors_means_an_empty_sum() {
    assert_eq!(0, sum_of_multiples(10_000, &[]))
}

#[test]
#[ignore]
fn the_only_multiple_of_0_is_0() {
    assert_eq!(0, sum_of_multiples(1, &[0]))
}

#[test]
#[ignore]
fn the_factor_0_does_not_affect_the_sum_of_multiples_of_other_factors() {
    assert_eq!(3, sum_of_multiples(4, &[3, 0]))
}
//Here comes the problematic test
#[test]
#[ignore]
fn solutions_using_include_exclude_must_extend_to_cardinality_greater_than_3() {
    assert_eq!(39_614_537, sum_of_multiples(10_000, &[2, 3, 5, 7, 11]))
}

rustc --version --verbose:

rustc 1.46.0 (04488afe3 2020-08-24)
binary: rustc
commit-hash: 04488afe34512aa4c33566eb16d8c912a3ae04f9
commit-date: 2020-08-24
host: x86_64-unknown-linux-gnu
release: 1.46.0
LLVM version: 10.0

The problem with nightly is identical.

rustc 1.48.0-nightly (fb1dc34a8 2020-09-21)
binary: rustc
commit-hash: fb1dc34a831688f8eca89ea22ea2eb39e881d729
commit-date: 2020-09-21
host: x86_64-unknown-linux-gnu
release: 1.48.0-nightly
LLVM version: 11.0

I tried getting a backtrace but that didn't work because I had to interrupt the process, or accept a melted CPU. Stracing the process also failed.

closed time in 3 days

hboetes

issue commentrust-lang/rust

test code more or less identical to the main() hangs.

This is not a compiler bug. solutions_using_include_exclude_must_extend_to_cardinality_greater_than_3 completes in a couple of seconds as expected. However, both tests that include 0 as a factor loop infinitely.

hboetes

comment created time in 3 days

pull request commentrust-lang/log

atomics: Add support for targets without atomics

Thanks!

alistair23

comment created time in 3 days

push eventrust-lang/log

Alistair Francis

commit sha 85b8a11565c77522b2c7334b6979c2a95b4b8344

build.rs: Update the list of non CAS targets Based on the implementation in the headless crate (https://github.com/japaric/heapless/blob/master/build.rs#L26) let's not enable CAS for three more targets. Signed-off-by: Alistair Francis <alistair.francis@wdc.com>

view details

Alistair Francis

commit sha 351ee33633497ad35a11eddd7a5afa242b9096fc

lib: Implement AtomicUsize for platforms without atomics Some platforms don't provide a AtomicUsize. Instead of just failing to build with this error: 291 | use std::sync::atomic::{AtomicUsize, Ordering}; | ^^^^^^^^^^^ no `AtomicUsize` in `sync::atomic` let's instead add a fake AtomicUsize. As the platform doesn't have atomics we can't implement an Atomic version of AtomicUsize, so this version is not atomic. Any platform without atomics is unlikely to have multiple cores, so this shouldn't be a problem. This is somewhat based on: https://github.com/japaric/heapless/commit/940d2e9d7f7ff57f9922b012fcad54cd46b673ae Signed-off-by: Alistair Francis <alistair.francis@wdc.com>

view details

Alistair Francis

commit sha 18ab92ffe66edf030f2fc493cabbe24b58501ec1

workflows/main.yml: Add an embedded riscv32imc test case Signed-off-by: Alistair Francis <alistair.francis@wdc.com>

view details

Alistair Francis

commit sha 5334a7ecee620b3ab1e3142fb8e361673eb11b5d

build.rs: Convert to functions Signed-off-by: Alistair Francis <alistair.francis@wdc.com>

view details

Alistair Francis

commit sha 3ae52e2729bdb4f9649628132ebcf9dc34e28fed

lib.rs: Add rationale comments Signed-off-by: Alistair Francis <alistair.francis@wdc.com>

view details

Steven Fackler

commit sha 9a1902dfc69eddc3fd815ba5a63cb7ef21d090db

Merge pull request #413 from alistair23/alistair/atomics atomics: Add support for targets without atomics

view details

push time in 3 days

PR merged rust-lang/log

atomics: Add support for targets without atomics

Some targets (such as RV32IMC) don't have atomic support. This PR allows the log crate to build for those targets.

As the platform doesn't have atomics we can't implement an Atomic version of AtomicUsize, so this version is not atomic. Any platform without atomics is unlikely to have multiple cores, so this shouldn't be a problem.

This is somewhat based on implementations in: https://github.com/japaric/heapless

+66 -4

6 comments

3 changed files

alistair23

pr closed time in 3 days

issue commentsfackler/rust-postgres

How to use the "postgres-types" crate ?

The deriving logic maps Rust enums to Postgres enums, not integers. You would need a manual implementation to do that.

apiraino

comment created time in 3 days

issue commentsfackler/rust-postgres

How to use the "postgres-types" crate ?

https://docs.rs/postgres-types/0.1.2/postgres_types/#naming

apiraino

comment created time in 3 days

issue commentsfackler/rust-postgres

How to use the "postgres-types" crate ?

You need to enable the derive feature in your Cargo.toml:

[dependencies]
postgres-types = { version = "0.1.2", features = ["derive"] }
apiraino

comment created time in 3 days

issue commentrust-lang/rust

io::Stderr should be line-buffered by default, not unbuffered

stderr is unbuffered in C:

Notes The stream stderr is unbuffered.

https://linux.die.net/man/3/stderr

zackw

comment created time in 3 days

pull request commentsfackler/rust-postgres

Permit configuring the notice callback

It's definitely safer to require a Sync bound, at least for now.

benesch

comment created time in 4 days

Pull request review commentsfackler/rust-postgres

Permit configuring the notice callback

 use tokio_postgres::{Error, Socket}; #[derive(Clone)] pub struct Config {     config: tokio_postgres::Config,+    notice_callback: Arc<dyn Fn(DbError) + Send>,

Oh right, mpsc channels aren't sync :/ I guess we'll just do this and see if it breaks anyone then :(

benesch

comment created time in 4 days

PullRequestReviewEvent
PullRequestReviewEvent

Pull request review commentsfackler/rust-postgres

Permit configuring the notice callback

 use tokio_postgres::{Error, Socket}; #[derive(Clone)] pub struct Config {     config: tokio_postgres::Config,+    notice_callback: Arc<dyn Fn(DbError) + Send>,

This does mean that Config will no longer be Sync - do you think it'll be a problem to require the closure to be Sync + Send instead?

benesch

comment created time in 4 days

Pull request review commentsfackler/rust-postgres

Permit configuring the notice callback

 impl Config {         self.config.get_channel_binding()     } +    /// Sets the notice callback.+    ///+    /// This callback will be invoked with the contents of every+    /// [`AsyncMessage::Notice`] that is received by the connection. Notices use+    /// the same structure as errors, but they are not "errors" per-se.+    ///+    /// Notices are distinct from notifications, which are instead accessible+    /// via the [`Notifications`] API.+    ///+    /// [`AsyncMessage::Notice`]: tokio_postgres::AsyncMessage::Notice+    /// [`Notifications`]: crate::Notifications+    pub fn notice_callback<F>(&mut self, f: F) -> &mut Config+    where+        F: Fn(DbError) + Clone + Send + 'static,+    {+        self.notice_callback = Box::new(f);+        self+    }++    /// Gets the current notice callback.+    pub fn get_notice_callback(&self) -> &(dyn FnMut(DbError) + Send) {

Yeah, let's remove it for now then.

benesch

comment created time in 4 days

PullRequestReviewEvent

pull request commentrust-lang/log

atomics: Add support for targets without atomics

Thanks!

cc @KodrAus does this seem okay to you as well? It's a bit scary, but it seems reasonable that a platform with no atomics can't really have threads either.

alistair23

comment created time in 4 days

push eventsfackler/rust-native-tls

Steven Fackler

commit sha 3f045130d72831c5bcd8cc10704b52f4eab44372

Add keyUsage for the root CA

view details

push time in 4 days

pull request commentsfackler/rust-openssl

Remove non-cargo directive output of environment variables

This is done intentionally to aid in debugging when the build script fails to find the openssl installation.

dfreese

comment created time in 4 days

push eventrust-lang/log

Lionel Faber

commit sha b5e9d0182a91a9c61885b51463cfe9ce629f6fa6

Implement Log for boxed data types that already implement the Log trait

view details

Steven Fackler

commit sha 7396e380ac9839a36d44ad5748142cf7f87cad51

Merge pull request #414 from lionel1704/boxed-impl Implement Log for Box<Log>

view details

push time in 4 days

PR merged rust-lang/log

Reviewers
Implement Log for Box<Log>

Hi there! I was trying to wrap a Box<dyn Log> returned from flexi logger into async_log but I was unable to do so since the Log trait was not implemented for Box<dyn Log>.

One option was to create a wrapper struct:

struct LoggerWrapper(Box<dyn Log>);

impl Log for LoggerWrapper {
    fn enabled(&self, metadata: &Metadata) -> bool {
        self.0.enabled(metadata)
    }

    fn log(&self, record: &Record) {
        self.0.log(record)
    }

    fn flush(&self) {
        self.0.flush();
    }
}

It was suggested to me that it might be beneficial to have the implementation in the log crate so I've added the implementation in this pull request.

Would you accept this change? I will be happy to make any changes or modifications if necessary.

+17 -0

0 comment

1 changed file

lionel1704

pr closed time in 4 days

Pull request review commentrust-lang/log

Implement Log for Box<Log>

 impl Log for NopLogger {     fn flush(&self) {} } +#[cfg(feature = "std")]+impl Log for std::boxed::Box<dyn Log> {

This can be made more general to impl<T> Log for Box<T> where T: ?Sized + Log { ... }

lionel1704

comment created time in 4 days

PullRequestReviewEvent

push eventsfackler/rust-native-tls

Steven Fackler

commit sha 2cd8b1c9e0f6b8298666dbcfee4419e9cc54a894

Add a CN

view details

push time in 5 days

push eventsfackler/rust-native-tls

Steven Fackler

commit sha ccd31bd6dbcff85528d555b2f028a650da51cbc4

Add a CN

view details

push time in 5 days

push eventsfackler/rust-native-tls

Steven Fackler

commit sha 76c253cdcb06df6f092ef08c7272683eef138228

asdf

view details

push time in 5 days

PR opened sfackler/rust-native-tls

Xcode bump

Closes #151

+88 -39

0 comment

9 changed files

pr created time in 5 days

push eventsfackler/rust-native-tls

Steven Fackler

commit sha 56aebffe41f4b18a204a6d2c1ad35f47cbfbc650

Update test certs for Catalina

view details

push time in 5 days

create barnchsfackler/rust-native-tls

branch : xcode-bump

created branch time in 5 days

pull request commentsfackler/rust-native-tls

update to latest dependecies version

Thanks!

alex-dukhno

comment created time in 5 days

push eventsfackler/rust-native-tls

Alex Dukhno

commit sha 04ccdf311f7705d3aee0ad8082f3541bad7d89fd

update to latest dependecies version

view details

Steven Fackler

commit sha 9a9e79825cde4705bad1b2192962066e29d365b5

Merge pull request #186 from alex-dukhno/update-dependecies update to latest dependecies version

view details

push time in 5 days

PR merged sfackler/rust-native-tls

update to latest dependecies version

Updating dependencies to their latest version. The reason is that grcov is failing to collect coverage during the build/test due to a bug in https://github.com/servo/core-foundation-rs/pull/357 that is dependency of security-framework

@sfackler can you have a look and merge?

Thanks

+6 -5

0 comment

2 changed files

alex-dukhno

pr closed time in 5 days

push eventsfackler/rust-postgres

Juan Aguilar Santillana

commit sha 391a54aea1afb3e333270b8532c351d70a9c4bd4

Avoiding get reference of a u16

view details

Juan Aguilar Santillana

commit sha a2ca75e9c46ac40510572f84790d25f686755453

Prettify `host` cast as str

view details

Steven Fackler

commit sha cd31c02d7772d5444eff982e2d7090e4e57174e6

Merge pull request #657 from botika/master Clean code at connect function

view details

push time in 5 days

PR merged sfackler/rust-postgres

Clean code at connect function

These are just two minor changes "Rustifying" the code.

+4 -3

0 comment

1 changed file

botika

pr closed time in 5 days

Pull request review commentsfackler/rust-postgres

Permit configuring the notice callback

 impl Config {         self.config.get_channel_binding()     } +    /// Sets the notice callback.+    ///+    /// This callback will be invoked with the contents of every+    /// [`AsyncMessage::Notice`] that is received by the connection. Notices use+    /// the same structure as errors, but they are not "errors" per-se.+    ///+    /// Notices are distinct from notifications, which are instead accessible+    /// via the [`Notifications`] API.+    ///+    /// [`AsyncMessage::Notice`]: tokio_postgres::AsyncMessage::Notice+    /// [`Notifications`]: crate::Notifications+    pub fn notice_callback<F>(&mut self, f: F) -> &mut Config+    where+        F: Fn(DbError) + Clone + Send + 'static,

That would also avoid the need for the NoticeCallback trait.

benesch

comment created time in 6 days

PullRequestReviewEvent

Pull request review commentsfackler/rust-postgres

Permit configuring the notice callback

 impl Config {         self.config.get_channel_binding()     } +    /// Sets the notice callback.+    ///+    /// This callback will be invoked with the contents of every+    /// [`AsyncMessage::Notice`] that is received by the connection. Notices use+    /// the same structure as errors, but they are not "errors" per-se.+    ///+    /// Notices are distinct from notifications, which are instead accessible+    /// via the [`Notifications`] API.+    ///+    /// [`AsyncMessage::Notice`]: tokio_postgres::AsyncMessage::Notice+    /// [`Notifications`]: crate::Notifications+    pub fn notice_callback<F>(&mut self, f: F) -> &mut Config+    where+        F: Fn(DbError) + Clone + Send + 'static,+    {+        self.notice_callback = Box::new(f);+        self+    }++    /// Gets the current notice callback.+    pub fn get_notice_callback(&self) -> &(dyn FnMut(DbError) + Send) {

This doesn't really seem to be that useful, right?

benesch

comment created time in 6 days

PullRequestReviewEvent

Pull request review commentsfackler/rust-postgres

Permit configuring the notice callback

 impl Config {         self.config.get_channel_binding()     } +    /// Sets the notice callback.+    ///+    /// This callback will be invoked with the contents of every+    /// [`AsyncMessage::Notice`] that is received by the connection. Notices use+    /// the same structure as errors, but they are not "errors" per-se.+    ///+    /// Notices are distinct from notifications, which are instead accessible+    /// via the [`Notifications`] API.+    ///+    /// [`AsyncMessage::Notice`]: tokio_postgres::AsyncMessage::Notice+    /// [`Notifications`]: crate::Notifications+    pub fn notice_callback<F>(&mut self, f: F) -> &mut Config+    where+        F: Fn(DbError) + Clone + Send + 'static,

I would just store this in an Arc internally rather than forcing the closure to be Clone.

benesch

comment created time in 6 days

PullRequestReviewEvent

pull request commentrust-lang/log

atomics: Add support for targets without atomics

This seems like a plausible approach, though I think we'll need to have CI target at least one of these architectures so the not(has_atomics) code doesn't rot.

alistair23

comment created time in 6 days

pull request commentrust-lang/rust

Relax promises about condition variable.

I agree that this is the best option - I can't imagine that anyone is actually depending on this exact behavior. I'm going to run this through libs FCP though just in case!

@rfcbot fcp merge

m-ou-se

comment created time in 6 days

issue closedopenssl/openssl

[3.0.0] Concurrent namemap initialization races and often fails

Here's a simple C program that spawns 10 threads, each of which create and initialize an EVP_MD_CTX to use SHA1:

#include <openssl/evp.h>
#include <openssl/err.h>
#include <pthread.h>

#define THREADS 10

void *thread(void *arg) {
	EVP_MD_CTX *ctx = EVP_MD_CTX_create();

	int r = EVP_DigestInit_ex(ctx, EVP_sha1(), NULL);
	if (r != 1) {
		ERR_print_errors_fp(stdout);
	}
}

int main() {
	pthread_t threads[THREADS];

	for (int i = 0; i < THREADS; i++) {
		pthread_create(&threads[i], NULL, thread, NULL);
	}

	for (int i = 0; i < THREADS; i++) {
		pthread_join(threads[i], NULL);
	}
}

When run against OpenSSL 3.0.0-alpha5 on a Linux VM with 12 cores, many of the threads report errors initializing OpenSSL's internal namemap:

00B7FFB50C7F0000:error::common libcrypto routines:ossl_namemap_add_names:internal error:crypto/core_namemap.c:310:Got number 12 when expecting 70
00B7FFB50C7F0000:error::common libcrypto routines:ossl_namemap_add_names:internal error:crypto/core_namemap.c:310:Got number 78 when expecting 94
00B7FFB50C7F0000:error::digital envelope routines:evp_generic_fetch:fetch failed:crypto/evp/evp_fetch.c:318:Global default library context, Algorithm (SHA1), Properties ()
00B7FFB50C7F0000:error::digital envelope routines:EVP_DigestInit_ex:initialization error:crypto/evp/digest.c:178:
0097FFB40C7F0000:error::common libcrypto routines:ossl_namemap_add_names:internal error:crypto/core_namemap.c:310:Got number 12 when expecting 71
0097FFB40C7F0000:error::digital envelope routines:evp_generic_fetch:fetch failed:crypto/evp/evp_fetch.c:318:Global default library context, Algorithm (SHA1), Properties ()
0097FFB40C7F0000:error::digital envelope routines:EVP_DigestInit_ex:initialization error:crypto/evp/digest.c:178:
00A77FB50C7F0000:error::digital envelope routines:evp_generic_fetch:fetch failed:crypto/evp/evp_fetch.c:318:Global default library context, Algorithm (SHA1), Properties ()
00A77FB50C7F0000:error::digital envelope routines:EVP_DigestInit_ex:initialization error:crypto/evp/digest.c:178:
00F7FF9F0C7F0000:error::common libcrypto routines:ossl_namemap_add_names:internal error:crypto/core_namemap.c:310:Got number 12 when expecting 44
00F7FF9F0C7F0000:error::common libcrypto routines:ossl_namemap_add_names:internal error:crypto/core_namemap.c:310:Got number 78 when expecting 79
00F7FF9F0C7F0000:error::digital envelope routines:evp_generic_fetch:fetch failed:crypto/evp/evp_fetch.c:318:Global default library context, Algorithm (SHA1), Properties ()
00F7FF9F0C7F0000:error::digital envelope routines:EVP_DigestInit_ex:initialization error:crypto/evp/digest.c:178:
00F7FFB70C7F0000:error::common libcrypto routines:ossl_namemap_add_names:conflicting names:crypto/core_namemap.c:290:"SHA-1" has an existing different identity 12 (from "SHA1:SHA-1")
00F7FFB70C7F0000:error::common libcrypto routines:ossl_namemap_add_names:conflicting names:crypto/core_namemap.c:290:"SHA-512" has an existing different identity 78 (from "SHA2-512:SHA-512:SHA512")
00F7FFB70C7F0000:error::digital envelope routines:evp_generic_fetch:fetch failed:crypto/evp/evp_fetch.c:318:Global default library context, Algorithm (SHA1), Properties ()
00F7FFB70C7F0000:error::digital envelope routines:EVP_DigestInit_ex:initialization error:crypto/evp/digest.c:178:
00E77FB70C7F0000:error::common libcrypto routines:ossl_namemap_add_names:conflicting names:crypto/core_namemap.c:290:"SHA-1" has an existing different identity 12 (from "SHA1:SHA-1")
00C77FB60C7F0000:error::common libcrypto routines:ossl_namemap_add_names:conflicting names:crypto/core_namemap.c:290:"SHA-1" has an existing different identity 12 (from "SHA1:SHA-1")
00C77FB60C7F0000:error::common libcrypto routines:ossl_namemap_add_names:conflicting names:crypto/core_namemap.c:290:"SHA-512" has an existing different identity 78 (from "SHA2-512:SHA-512:SHA512")
00C77FB60C7F0000:error::digital envelope routines:evp_generic_fetch:fetch failed:crypto/evp/evp_fetch.c:318:Global default library context, Algorithm (SHA1), Properties ()
0027D1BC0C7F0000:error::common libcrypto routines:ossl_namemap_add_names:conflicting names:crypto/core_namemap.c:290:"SHA-1" has an existing different identity 12 (from "SHA1:SHA-1")
00C77FB60C7F0000:error::digital envelope routines:EVP_DigestInit_ex:initialization error:crypto/evp/digest.c:178:
0027D1BC0C7F0000:error::common libcrypto routines:ossl_namemap_add_names:conflicting names:crypto/core_namemap.c:290:"SHA-512" has an existing different identity 78 (from "SHA2-512:SHA-512:SHA512")
0027D1BC0C7F0000:error::digital envelope routines:evp_generic_fetch:fetch failed:crypto/evp/evp_fetch.c:318:Global default library context, Algorithm (SHA1), Properties ()
0027D1BC0C7F0000:error::digital envelope routines:EVP_DigestInit_ex:initialization error:crypto/evp/digest.c:178:
00E77FB70C7F0000:error::common libcrypto routines:ossl_namemap_add_names:conflicting names:crypto/core_namemap.c:290:"SHA-512" has an existing different identity 78 (from "SHA2-512:SHA-512:SHA512")
00E77FB70C7F0000:error::digital envelope routines:evp_generic_fetch:fetch failed:crypto/evp/evp_fetch.c:318:Global default library context, Algorithm (SHA1), Properties ()
00E77FB70C7F0000:error::digital envelope routines:EVP_DigestInit_ex:initialization error:crypto/evp/digest.c:178:
003751BD0C7F0000:error::common libcrypto routines:ossl_namemap_add_names:conflicting names:crypto/core_namemap.c:290:"SHA-1" has an existing different identity 12 (from "SHA1:SHA-1")
00D7FFB60C7F0000:error::common libcrypto routines:ossl_namemap_add_names:conflicting names:crypto/core_namemap.c:290:"SHA-1" has an existing different identity 12 (from "SHA1:SHA-1")
00D7FFB60C7F0000:error::common libcrypto routines:ossl_namemap_add_names:conflicting names:crypto/core_namemap.c:290:"SHA-512" has an existing different identity 78 (from "SHA2-512:SHA-512:SHA512")
00D7FFB60C7F0000:error::digital envelope routines:evp_generic_fetch:fetch failed:crypto/evp/evp_fetch.c:318:Global default library context, Algorithm (SHA1), Properties ()
00D7FFB60C7F0000:error::digital envelope routines:EVP_DigestInit_ex:initialization error:crypto/evp/digest.c:178:
003751BD0C7F0000:error::common libcrypto routines:ossl_namemap_add_names:conflicting names:crypto/core_namemap.c:290:"SHA-512" has an existing different identity 78 (from "SHA2-512:SHA-512:SHA512")
003751BD0C7F0000:error::digital envelope routines:evp_generic_fetch:fetch failed:crypto/evp/evp_fetch.c:318:Global default library context, Algorithm (SHA1), Properties ()
003751BD0C7F0000:error::digital envelope routines:EVP_DigestInit_ex:initialization error:crypto/evp/digest.c:178:

The program runs without errors when configured to spawn a single thread, so it seems like the namemap code has some concurrency bugs.

closed time in 7 days

sfackler

issue commentsfackler/rust-postgres

Disconnect database connection

The connection will close when you drop the client.

SeanOMik

comment created time in 8 days

issue commentrust-lang/rust

Source file names are included into a release binary even if abort upon panic is enabled

Why is --remap-path-prefix not sufficient to deal with privacy concerns?

dmitry-zakablukov

comment created time in 9 days

issue commentsfackler/r2d2

Will r2d2 create more connections than max_size when using builder()?

If the number of active connections is at the max_size, the pool will not make more connections.

GimpFlamingo

comment created time in 10 days

issue commentsfackler/r2d2

Will r2d2 create more connections than max_size when using builder()?

The maximum size is the maximum number of connections the pool will maintain concurrently.

GimpFlamingo

comment created time in 10 days

Pull request review commentsfackler/rust-openssl

Add X509Ref::version

 impl X509Ref {         }     } +    /// Returns certificate version. If this certificate has no explicit version set, it defaults to+    /// version&nbsp;1.+    ///+    /// Note that `0` return value stands for version 1, `1`&nbsp;&ndash; for version 2 and so on.+    ///+    /// This corresponds to [`X509_get_version`].+    ///+    /// [`X509_get_version`]: https://www.openssl.org/docs/man1.1.1/man3/X509_get_version.html+    #[cfg(ossl110)]+    pub fn version(&self) -> i32 {+        // Covered with `x509_ref_version()`, `x509_ref_version_no_version_set()`,+        // `x509_ref_version_incorrect_version_set()` tests+        unsafe { ffi::X509_get_version(self.as_ptr()) as i32 }

This is fine.

igorty

comment created time in 12 days

PullRequestReviewEvent

Pull request review commentsfackler/rust-openssl

Add X509Ref::version

 pub mod extension; pub mod store;  #[cfg(test)]-mod tests;+mod tests {+    #[cfg(ossl110)]+    use x509::X509Builder;++    /// Tests `X509Ref::version` happy path.+    #[cfg(ossl110)]+    #[test]+    fn x509_ref_version() {+        let mut builder = X509Builder::new().unwrap();+        let expected_version = 2;+        builder+            .set_version(expected_version)+            .expect("Failed to set certificate version");+        let cert = builder.build();+        let actual_version = cert.version();+        assert_eq!(+            expected_version, actual_version,+            "Obtained certificate version is incorrect",+        );+    }++    /// Tests `X509Ref::version`. Checks case when no version has been set, so a default one is+    /// returned.+    #[cfg(ossl110)]+    #[test]+    fn x509_ref_version_no_version_set() {+        let cert = X509Builder::new().unwrap().build();+        let actual_version = cert.version();+        assert_eq!(+            0, actual_version,+            "Default certificate version is incorrect",+        );+    }++    /// Tests `X509Ref::version`. Checks case when there was an attempt to set incorrect version+    /// before a call to the tested method.+    ///+    /// _Note._ As for now this test is disabled since OpenSSL erroneously allows to set any number+    /// as a certificate version. See corresponding [`issue`].+    ///+    /// [`issue`]: https://github.com/openssl/openssl/issues/12138+    #[cfg(ossl110)]+    #[test]+    #[ignore]+    fn x509_ref_version_incorrect_version_set() {

I don't think it makes sense to write a test for a case that the underlying library does not handle.

igorty

comment created time in 12 days

PullRequestReviewEvent

Pull request review commentsfackler/rust-openssl

Add X509Ref::version

 extern "C" {     pub fn X509_get_pubkey(x: *mut X509) -> *mut EVP_PKEY;      pub fn X509_set_version(x: *mut X509, version: c_long) -> c_int;+    #[cfg(ossl110)]

OpenSSL's man pages do not cover every single function the library exposes.

igorty

comment created time in 12 days

PullRequestReviewEvent

pull request commentrust-lang/rust

slice::from_raw_parts: explicitly mention that data must be initialized

@bors r+ rollup

RalfJung

comment created time in 12 days

push eventsfackler/rust-openssl

Hidekatsu Izuno

commit sha c4cbf496c794d554cf76a369f1f94066c2e14a45

Add ecx support

view details

Steven Fackler

commit sha 0a0da84f939090f72980c77f40199fc76245d289

Merge pull request #1342 from hidekatsu-izuno/support-ecx Add ecx (X25519, X448) support

view details

push time in 12 days

PR merged sfackler/rust-openssl

Add ecx (X25519, X448) support

I'm developing josekit to support JWE in Rust.

The ECDH-ES algorithm in JWE spec needs a ecx (X25519, X448) feature. This feature is supported by openssl. But not by rust-openssl, So I added some constants based on openssl-1.1.1g.

If you can, I'd be happy to merge it.

+24 -0

0 comment

3 changed files

hidekatsu-izuno

pr closed time in 12 days

pull request commentsfackler/rust-openssl

Implement signing a CSR with a CA certificate.

You could always propose exposing this method in OpenSSL itself, which we could then pick up. I am hesitant to land complex aggregate operations like this because it often turns out that the thing that worked for whoever added it is subtly different from what someone else needs.

griwes

comment created time in 13 days

Pull request review commentsfackler/rust-openssl

Add X509Ref::version

 impl X509Ref {         }     } +    /// Returns certificate version. If this certificate has no explicit version set, it defaults to+    /// version&nbsp;1.+    ///+    /// Note that `0` return value stands for version 1, `1`&nbsp;&ndash; for version 2 and so on.+    ///+    /// This corresponds to [`X509_get_version`].+    ///+    /// [`X509_get_version`]: https://www.openssl.org/docs/man1.1.1/man3/X509_get_version.html+    pub fn version(&self) -> Result<i64, ErrorStack> {+        // Covered with `x509_ref_version()`, `x509_ref_version_no_version_set()`,+        // `x509_ref_version_incorrect_version_set()` tests+        unsafe { cvt_long_n(ffi::X509_get_version(self.as_ptr())) }

The man page for X509_get_version does not claim it ever returns an error.

igorty

comment created time in 13 days

PullRequestReviewEvent

Pull request review commentsfackler/rust-openssl

Add X509Ref::version

 extern "C" {     pub fn X509_get_pubkey(x: *mut X509) -> *mut EVP_PKEY;      pub fn X509_set_version(x: *mut X509, version: c_long) -> c_int;+    /// Returns certificate version previously set through `X509_set_version` or the default which+    /// is `0`.+    ///+    /// **Important.** The corresponding OpenSSL method is not&nbsp;expected to fail under its+    /// correct implementation. Despite that, the method invocation passes through scopes which+    /// _may_ result in error. Having that it is encouraged to validate returned value.+    pub fn X509_get_version(x: *const X509) -> c_long;

There's no need to document function definitions in openssl-sys.

igorty

comment created time in 13 days

PullRequestReviewEvent

issue commentrust-lang/docker-rust

Provide Alpine images for ARM

I am not involved in rustup - you should ask them.

amyspark

comment created time in 14 days

pull request commentrust-lang/rust

Implement PartialOrd and PartialEq for UTF-8 strings and FFI Strings

Those type inference errors are the problems that adding more impls like these cause. If it's breaking something in the compiler, there's a good chance it's going to break quite a bit of the ecosystem as well.

lopopolo

comment created time in 15 days

pull request commentsfackler/rust-openssl

Implement signing a CSR with a CA certificate.

I generally prefer to keep the API fairly close to direct bindings to OpenSSL functions. I think this would make sense as documentation or an example though.

griwes

comment created time in 15 days

issue commentrust-lang/rust

Tracking Issue for Read::is_read_vectored/Write::is_write_vectored.

Those are not compatible with trait objects.

sfackler

comment created time in 15 days

issue commentrust-lang/docker-rust

Provide Alpine images for ARM

Not off the top of my head. You could check their github.

amyspark

comment created time in 15 days

issue commentrust-lang/docker-rust

Provide Alpine images for ARM

That means that there is a Rust toolchain for ARM musl. There is not a rustup binary for ARM msul, though: https://rust-lang.github.io/rustup/installation/other.html

amyspark

comment created time in 15 days

pull request commentsfackler/rust-native-tls

corrected parameter name for PEM-encoded cert

Thanks!

LesnyRumcajs

comment created time in 17 days

more