Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
Signed-off-by: jason yang <jasonyangshadow@gmail.com>
  • Loading branch information
JasonYangShadow committed Mar 18, 2024
1 parent f003374 commit 1d53bf0
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 52 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ For older changes see the [archived Singularity change log](https://github.com/a

## Changes for v1.3.x

- Fixed the time discrepancy issue between the host and container, which occurs
when host's timezone is different from container's.

## v1.3.0 - \[2024-03-12\]

Changes since v1.2.5
Expand Down
30 changes: 0 additions & 30 deletions internal/pkg/runtime/engine/apptainer/container_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import (
"context"
"fmt"
"io"
iofs "io/fs"
"os"
osuser "os/user"
"path/filepath"
Expand Down Expand Up @@ -628,35 +627,6 @@ func (c *container) addMountInfo(system *mount.System) error {
return nil
}

// unsymlinkLocaltime will remove the symlink of /etc/localtime inside container
// to resolve time discrepancy issue. see: https://github.com/apptainer/apptainer/issues/1868
// This patch is only applied for overlay session layout and utilizes whiteout feature.
func (c *container) unsymlinkLocatime(system *mount.System) error {
const (
localtime = "/etc/localtime"
)

// only works when the sesion layer is apptainer.OverlayLayer
if c.engine.EngineConfig.GetSessionLayer() == apptainer.OverlayLayer {
localtimePath := filepath.Join(c.session.RootFsPath(), localtime)
// check whether the localtime is symlink inside container
fileInfo, err := c.rpcOps.Lstat(localtimePath)
if err == nil && (fileInfo.Mode()&iofs.ModeSymlink) != 0 {
sylog.Debugf("Localtime file: %s inside container is symlink, will patch it", localtimePath)
if sessionLowerDir, err := c.session.GetPath(c.session.Layer.Dir()); err == nil {
whiteoutPath := filepath.Join(sessionLowerDir, localtime)
if err := c.rpcOps.Mkdir(filepath.Dir(whiteoutPath), 0o755); err != nil {
return fmt.Errorf("while creating %s's parent dir, err: %s", whiteoutPath, err)
}
if err := c.rpcOps.Mknod(whiteoutPath, unix.S_IFCHR, 0); err != nil {
return fmt.Errorf("while creating %s: %s", whiteoutPath, err)
}
}
}
}
return nil
}

func (c *container) chdirFinal(system *mount.System) error {
if _, err := c.rpcOps.Chdir(c.session.FinalPath()); err != nil {
return err
Expand Down
7 changes: 0 additions & 7 deletions internal/pkg/runtime/engine/apptainer/rpc/args.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,13 +159,6 @@ type NvCCLIArgs struct {
UserNS bool
}

// Mknod defines the arguments to Mknod
type MknodArgs struct {
Path string
Mode uint32
Dev int
}

// FileInfo returns FileInfo interface to be passed as RPC argument.
func FileInfo(fi os.FileInfo) os.FileInfo {
return &fileInfo{
Expand Down
10 changes: 0 additions & 10 deletions internal/pkg/runtime/engine/apptainer/rpc/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -282,13 +282,3 @@ func (t *RPC) NvCCLI(flags []string, rootFsPath string, userNS bool) error {
}
return t.Client.Call(t.Name+".NvCCLI", arguments, nil)
}

// Mknod will call mknod
func (t *RPC) Mknod(path string, mode uint32, dev int) error {
arguments := &args.MknodArgs{
Path: path,
Mode: mode,
Dev: dev,
}
return t.Client.Call(t.Name+".Mknod", arguments, nil)
}
Original file line number Diff line number Diff line change
Expand Up @@ -470,8 +470,3 @@ func (t *Methods) NvCCLI(arguments *args.NvCCLIArgs, reply *int) (err error) {

return gpu.NVCLIConfigure(arguments.Flags, arguments.RootFsPath, arguments.UserNS)
}

// Mknod will call mknod method inside container
func (t *Methods) Mknod(arguments *args.MknodArgs, reply *int) (err error) {
return unix.Mknod(arguments.Path, arguments.Mode, arguments.Dev)
}

0 comments on commit 1d53bf0

Please sign in to comment.