Version 1.1.2

This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2022-03-28 10:33:56 +02:00
parent 98a76801ca
commit 53f62d7551
4 changed files with 3 additions and 47 deletions

1
.gitignore vendored
View File

@ -9,3 +9,4 @@
/zram-generator-1.0.1.crate
/zram-generator-1.1.0.crate
/zram-generator-1.1.1.crate
/zram-generator-1.1.2.crate

View File

@ -1,43 +0,0 @@
From dd796f67352de9a8b3602a20d37d68b3a903cc78 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Wed, 1 Dec 2021 16:15:08 +0100
Subject: [PATCH] Skip test if unshare fails
---
tests/test_cases.rs | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/tests/test_cases.rs b/tests/test_cases.rs
index 66023137e6..1d8c5e6d65 100644
--- a/tests/test_cases.rs
+++ b/tests/test_cases.rs
@@ -6,18 +6,26 @@ use anyhow::Result;
use fs_extra::dir::{copy, CopyOptions};
use std::fs;
use std::io::{self, Write};
+use log::warn;
use std::path::Path;
-use std::process::Command;
+use std::process::{Command, exit};
use tempfile::TempDir;
#[ctor::ctor]
fn unshorn() {
- use nix::{mount, sched, unistd};
+ use nix::{errno, mount, sched, unistd};
use std::os::unix::fs::symlink;
let (uid, gid) = (unistd::geteuid(), unistd::getegid());
if !uid.is_root() {
- sched::unshare(sched::CloneFlags::CLONE_NEWUSER).expect("unshare(NEWUSER)");
+ match sched::unshare(sched::CloneFlags::CLONE_NEWUSER) {
+ Ok(_) => {}
+ Err(errno::Errno::EPERM) => {
+ warn!("No permission to unshare namespace, skipping tests");
+ exit(0);
+ }
+ Err(err) => panic!("Unexpected error: {}", err),
+ }
fs::write("/proc/self/setgroups", b"deny").unwrap();
fs::write("/proc/self/uid_map", format!("0 {} 1", uid)).unwrap();
fs::write("/proc/self/gid_map", format!("0 {} 1", gid)).unwrap();

View File

@ -4,7 +4,7 @@
%global crate zram-generator
Name: rust-%{crate}
Version: 1.1.1
Version: 1.1.2
Release: %autorelease
Summary: Systemd unit generator for zram swap devices
@ -14,8 +14,6 @@ URL: https://crates.io/crates/zram-generator
Source: %{crates_source}
Source1: zram-generator.conf
Patch1: 0001-Skip-test-if-unshare-fails.patch
ExclusiveArch: %{rust_arches}
BuildRequires: rust-packaging

View File

@ -1 +1 @@
SHA512 (zram-generator-1.1.1.crate) = eb229d8b6d18183981830658cf27ed7ee64de5ee523a1187c454c9bb8410566b9d8d4c35f04eb2f3dfc8c4d1826344b1bf5f49608edf9f3c1051d4fc76bbe093
SHA512 (zram-generator-1.1.2.crate) = dfad7d4384eb4635c33475e4571d33a3135c92cf42138dd1cb50f19aef4b3f2465130783e385a3f544e43a1653273cee9b2d8f45177a8b053acf37805dc939c8