Skip to content

techdebt: remove support for old distros (3.10 targets) #703

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
seccomp headers at build time. Run `mconfig` using `--without-seccomp` and
`--without-conmon` to disable seccomp support and building of `conmon`
(which requires seccomp headers).
- SingularityCE now requires squashfs-tools >=4.3, which is satisfied by
current EL / Ubuntu / Debian and other distributions.

### New features / functionalities

Expand Down
4 changes: 1 addition & 3 deletions cmd/starter/c/include/capability.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,9 @@
/* 37 is the latest cap since many kernel versions */
#define CAPSET_MAX 37

/* Support only 64 bits sets, since kernel 2.6.25 */
/* Support only 64 bits sets, since kernel 2.6.26 */
#ifdef _LINUX_CAPABILITY_VERSION_3
# define LINUX_CAPABILITY_VERSION _LINUX_CAPABILITY_VERSION_3
#elif defined(_LINUX_CAPABILITY_VERSION_2)
# define LINUX_CAPABILITY_VERSION _LINUX_CAPABILITY_VERSION_2
#else
# error Linux 64 bits capability set not supported
#endif /* _LINUX_CAPABILITY_VERSION_3 */
Expand Down
7 changes: 1 addition & 6 deletions e2e/inspect/inspect.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,7 @@ func (c ctx) singularityInspect(t *testing.T) {
// it can't set system xattrs while rootless.
cmd := exec.Command("unsquashfs", "-user-xattrs", "-d", sandboxImage, squashImage)
if res := cmd.Run(t); res.Error != nil {
// If we failed, then try without -user-xattrs for older unsquashfs
// versions that don't have that flag.
cmd := exec.Command("unsquashfs", "-d", sandboxImage, squashImage)
if res := cmd.Run(t); res.Error != nil {
t.Fatalf("Unexpected error while running command.\n%s", res)
}
t.Fatalf("Unexpected error while running command.\n%s", res)
}

compareLabel := func(label, out string, appName string) func(*testing.T, *inspect.Metadata) {
Expand Down
39 changes: 7 additions & 32 deletions internal/pkg/image/unpacker/squashfs.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
package unpacker

import (
"bytes"
"fmt"
"io"
"io/ioutil"
Expand Down Expand Up @@ -104,20 +103,19 @@ func (s *Squashfs) extract(files []string, reader io.Reader, dest string) (err e
}
}

// First we try unsquashfs with appropriate xattr options.
// If we are in rootless mode we need "-user-xattrs" so we don't try to set system xattrs that require root.
// However...
// 1. This isn't supported on unsquashfs 4.0 in RHEL6 so we have to fall back to not using that option on failure.
// 2. Must check (user) xattrs are supported on the FS as unsquashfs >=4.4 will give a non-zero error code if
// it cannot set them, e.g. on tmpfs (#5668)
// First we try unsquashfs with appropriate xattr options. If we are in
// rootless mode we need "-user-xattrs" so we don't try to set system xattrs
// that require root. However we must check (user) xattrs are supported on
// the FS as unsquashfs >=4.4 will give a non-zero error code if it cannot
// set them, e.g. on tmpfs (#5668)
opts := []string{}
hostuid, err := namespaces.HostUID()
if err != nil {
return fmt.Errorf("could not get host UID: %s", err)
}
rootless := hostuid != 0

// Do we support user xattrs?
// Does our target filesystem support user xattrs?
ok, err := TestUserXattr(filepath.Dir(dest))
if err != nil {
return err
Expand Down Expand Up @@ -167,33 +165,10 @@ func (s *Squashfs) extract(files []string, reader io.Reader, dest string) (err e
cmd.Stdin = reader
}

o, err := cmd.CombinedOutput()
if err == nil {
return nil
}

// Invalid options give output...
// SYNTAX: unsquashfs [options] filesystem [directories or files to extract]
if bytes.Contains(o, []byte("SYNTAX")) {
sylog.Warningf("unsquashfs does not support %v. Images with xattrs may fail to extract", opts)
} else {
// A different error is fatal
return fmt.Errorf("extract command failed: %s: %s", string(o), err)
}

// Now we fall back to running without additional xattr options - to do the best we can on old 4.0 squashfs that
// does not support them.
cmd, err = cmdFunc(s.UnsquashfsPath, dest, filter, filename)
if err != nil {
return fmt.Errorf("command error: %s", err)
}
cmd.Args = append(cmd.Args, files...)
if stdin {
cmd.Stdin = reader
}
if o, err := cmd.CombinedOutput(); err != nil {
return fmt.Errorf("extract command failed: %s: %s", string(o), err)
}

return nil
}

Expand Down
13 changes: 0 additions & 13 deletions pkg/network/network_linux_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -517,19 +517,6 @@ func testBadBridge(nsPath string, cniPath *CNIPath, stdin io.WriteCloser, stdout
func TestAddDelNetworks(t *testing.T) {
test.EnsurePrivilege(t)

// centos 6 doesn't support bridge/veth, only macvlan
// just skip tests on centos 6, rhel 6
b, err := ioutil.ReadFile("/etc/system-release-cpe")
if err == nil {
fields := strings.Split(string(b), ":")
switch fields[2] {
case "centos", "redhat":
if strings.HasPrefix(fields[4], "6") {
t.Skipf("RHEL6/CentOS6 don't support CNI bridge/veth - skipping")
}
}
}

cniPath := &CNIPath{
Conf: defaultCNIConfPath,
Plugin: defaultCNIPluginPath,
Expand Down