chore(ops/posix_mq.rs): upgrade to nix 0.23
The previous version had a CVE. As part of this upgrade, the handling of errors inside of the Nix crate changed, which we now accommodate. Change-Id: Iad9a473c1782e0d79919cb5dc3f76316852d8a16 Reviewed-on: https://cl.tvl.fyi/c/depot/+/5226 Tested-by: BuildkiteCI Autosubmit: tazjin <tazjin@tvl.su> Reviewed-by: sterni <sternenseemann@systemli.org>
This commit is contained in:
		
							parent
							
								
									a2ecd53f58
								
							
						
					
					
						commit
						91ef2b671e
					
				
					 3 changed files with 50 additions and 49 deletions
				
			
		
							
								
								
									
										55
									
								
								ops/posix_mq.rs/Cargo.lock
									
										
									
										generated
									
									
									
								
							
							
						
						
									
										55
									
								
								ops/posix_mq.rs/Cargo.lock
									
										
									
										generated
									
									
									
								
							|  | @ -1,54 +1,63 @@ | ||||||
| # This file is automatically @generated by Cargo. | # This file is automatically @generated by Cargo. | ||||||
| # It is not intended for manual editing. | # It is not intended for manual editing. | ||||||
|  | version = 3 | ||||||
|  | 
 | ||||||
|  | [[package]] | ||||||
|  | name = "autocfg" | ||||||
|  | version = "1.0.1" | ||||||
|  | source = "registry+https://github.com/rust-lang/crates.io-index" | ||||||
|  | checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a" | ||||||
|  | 
 | ||||||
| [[package]] | [[package]] | ||||||
| name = "bitflags" | name = "bitflags" | ||||||
| version = "1.2.1" | version = "1.2.1" | ||||||
| source = "registry+https://github.com/rust-lang/crates.io-index" | source = "registry+https://github.com/rust-lang/crates.io-index" | ||||||
|  | checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" | ||||||
| 
 | 
 | ||||||
| [[package]] | [[package]] | ||||||
| name = "cc" | name = "cc" | ||||||
| version = "1.0.50" | version = "1.0.50" | ||||||
| source = "registry+https://github.com/rust-lang/crates.io-index" | source = "registry+https://github.com/rust-lang/crates.io-index" | ||||||
|  | checksum = "95e28fa049fda1c330bcf9d723be7663a899c4679724b34c81e9f5a326aab8cd" | ||||||
| 
 | 
 | ||||||
| [[package]] | [[package]] | ||||||
| name = "cfg-if" | name = "cfg-if" | ||||||
| version = "0.1.10" | version = "1.0.0" | ||||||
| source = "registry+https://github.com/rust-lang/crates.io-index" | source = "registry+https://github.com/rust-lang/crates.io-index" | ||||||
|  | checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" | ||||||
| 
 | 
 | ||||||
| [[package]] | [[package]] | ||||||
| name = "libc" | name = "libc" | ||||||
| version = "0.2.66" | version = "0.2.117" | ||||||
| source = "registry+https://github.com/rust-lang/crates.io-index" | source = "registry+https://github.com/rust-lang/crates.io-index" | ||||||
|  | checksum = "e74d72e0f9b65b5b4ca49a346af3976df0f9c61d550727f349ecd559f251a26c" | ||||||
|  | 
 | ||||||
|  | [[package]] | ||||||
|  | name = "memoffset" | ||||||
|  | version = "0.6.5" | ||||||
|  | source = "registry+https://github.com/rust-lang/crates.io-index" | ||||||
|  | checksum = "5aa361d4faea93603064a027415f07bd8e1d5c88c9fbf68bf56a285428fd79ce" | ||||||
|  | dependencies = [ | ||||||
|  |  "autocfg", | ||||||
|  | ] | ||||||
| 
 | 
 | ||||||
| [[package]] | [[package]] | ||||||
| name = "nix" | name = "nix" | ||||||
| version = "0.16.1" | version = "0.23.1" | ||||||
| source = "registry+https://github.com/rust-lang/crates.io-index" | source = "registry+https://github.com/rust-lang/crates.io-index" | ||||||
|  | checksum = "9f866317acbd3a240710c63f065ffb1e4fd466259045ccb504130b7f668f35c6" | ||||||
| dependencies = [ | dependencies = [ | ||||||
|  "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", |  "bitflags", | ||||||
|  "cc 1.0.50 (registry+https://github.com/rust-lang/crates.io-index)", |  "cc", | ||||||
|  "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", |  "cfg-if", | ||||||
|  "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", |  "libc", | ||||||
|  "void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", |  "memoffset", | ||||||
| ] | ] | ||||||
| 
 | 
 | ||||||
| [[package]] | [[package]] | ||||||
| name = "posix_mq" | name = "posix_mq" | ||||||
| version = "0.9.0" | version = "0.9.0" | ||||||
| dependencies = [ | dependencies = [ | ||||||
|  "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", |  "libc", | ||||||
|  "nix 0.16.1 (registry+https://github.com/rust-lang/crates.io-index)", |  "nix", | ||||||
| ] | ] | ||||||
| 
 |  | ||||||
| [[package]] |  | ||||||
| name = "void" |  | ||||||
| version = "1.0.2" |  | ||||||
| source = "registry+https://github.com/rust-lang/crates.io-index" |  | ||||||
| 
 |  | ||||||
| [metadata] |  | ||||||
| "checksum bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" |  | ||||||
| "checksum cc 1.0.50 (registry+https://github.com/rust-lang/crates.io-index)" = "95e28fa049fda1c330bcf9d723be7663a899c4679724b34c81e9f5a326aab8cd" |  | ||||||
| "checksum cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" |  | ||||||
| "checksum libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)" = "d515b1f41455adea1313a4a2ac8a8a477634fbae63cc6100e3aebb207ce61558" |  | ||||||
| "checksum nix 0.16.1 (registry+https://github.com/rust-lang/crates.io-index)" = "dd0eaf8df8bab402257e0a5c17a254e4cc1f72a93588a1ddfb5d356c801aa7cb" |  | ||||||
| "checksum void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" |  | ||||||
|  |  | ||||||
|  | @ -7,5 +7,5 @@ license = "MIT" | ||||||
| repository = "https://git.tazj.in/tree/ops/posix_mq.rs" | repository = "https://git.tazj.in/tree/ops/posix_mq.rs" | ||||||
| 
 | 
 | ||||||
| [dependencies] | [dependencies] | ||||||
| nix = "0.16" | nix = "0.23" | ||||||
| libc = "0.2" | libc = "0.2" | ||||||
|  |  | ||||||
|  | @ -47,7 +47,7 @@ pub enum Error { | ||||||
| 
 | 
 | ||||||
|     // Some other unexpected / unknown error occured. This is probably an error from
 |     // Some other unexpected / unknown error occured. This is probably an error from
 | ||||||
|     // the nix crate. Bug reports also welcome for this!
 |     // the nix crate. Bug reports also welcome for this!
 | ||||||
|     UnknownInternalError(Option<nix::Error>), |     UnknownInternalError(), | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| impl fmt::Display for Error { | impl fmt::Display for Error { | ||||||
|  | @ -74,7 +74,7 @@ impl fmt::Display for Error { | ||||||
|                 "maximum number of system file descriptors reached" |                 "maximum number of system file descriptors reached" | ||||||
|             } |             } | ||||||
|             UnknownForeignError(_) => "unknown foreign error occured: please report a bug!", |             UnknownForeignError(_) => "unknown foreign error occured: please report a bug!", | ||||||
|             UnknownInternalError(_) => "unknown internal error occured: please report a bug!", |             UnknownInternalError() => "unknown internal error occured: please report a bug!", | ||||||
|         }) |         }) | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  | @ -91,11 +91,20 @@ impl error::Error for Error { | ||||||
| 
 | 
 | ||||||
| /// This from implementation is used to translate errors from the lower-level
 | /// This from implementation is used to translate errors from the lower-level
 | ||||||
| /// C-calls into sensible Rust errors.
 | /// C-calls into sensible Rust errors.
 | ||||||
| impl From<nix::Error> for Error { | impl From<nix::errno::Errno> for Error { | ||||||
|     fn from(e: nix::Error) -> Self { |     fn from(err: nix::Error) -> Self { | ||||||
|         match e { |         use nix::errno::Errno::*; | ||||||
|             nix::Error::Sys(e) => match_errno(e), |         match err { | ||||||
|             _ => Error::UnknownInternalError(Some(e)), |             EACCES => Error::PermissionDenied(), | ||||||
|  |             EBADF => Error::InvalidQueueDescriptor(), | ||||||
|  |             EINTR => Error::QueueCallInterrupted(), | ||||||
|  |             EEXIST => Error::QueueAlreadyExists(), | ||||||
|  |             EMFILE => Error::ProcessFileDescriptorLimitReached(), | ||||||
|  |             ENFILE => Error::SystemFileDescriptorLimitReached(), | ||||||
|  |             ENOENT => Error::QueueNotFound(), | ||||||
|  |             ENOMEM => Error::InsufficientMemory(), | ||||||
|  |             ENOSPC => Error::InsufficientSpace(), | ||||||
|  |             _ => Error::UnknownForeignError(err), | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  | @ -111,23 +120,6 @@ impl From<io::Error> for Error { | ||||||
| // here because the system is probably seriously broken if those files don't contain numbers.
 | // here because the system is probably seriously broken if those files don't contain numbers.
 | ||||||
| impl From<num::ParseIntError> for Error { | impl From<num::ParseIntError> for Error { | ||||||
|     fn from(_: num::ParseIntError) -> Self { |     fn from(_: num::ParseIntError) -> Self { | ||||||
|         Error::UnknownInternalError(None) |         Error::UnknownInternalError() | ||||||
|     } |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| fn match_errno(err: nix::errno::Errno) -> Error { |  | ||||||
|     use nix::errno::Errno::*; |  | ||||||
| 
 |  | ||||||
|     match err { |  | ||||||
|         EACCES => Error::PermissionDenied(), |  | ||||||
|         EBADF => Error::InvalidQueueDescriptor(), |  | ||||||
|         EINTR => Error::QueueCallInterrupted(), |  | ||||||
|         EEXIST => Error::QueueAlreadyExists(), |  | ||||||
|         EMFILE => Error::ProcessFileDescriptorLimitReached(), |  | ||||||
|         ENFILE => Error::SystemFileDescriptorLimitReached(), |  | ||||||
|         ENOENT => Error::QueueNotFound(), |  | ||||||
|         ENOMEM => Error::InsufficientMemory(), |  | ||||||
|         ENOSPC => Error::InsufficientSpace(), |  | ||||||
|         _ => Error::UnknownForeignError(err), |  | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue