[elbe-devel] [PATCH v3 0/8] issue-199 - Dangling links

dion at linutronix.de dion at linutronix.de
Wed May 29 16:24:52 CEST 2019


From: Olivier Dion <dion at linutronix.de>

This patch try to fixes wrong expected behavior of
'os.path.exists'.  Almost all used of 'os.path.exists' have
been reviewed.


* lexists
=========

The method 'lexists' is add to the Filesystem class.

In every case where we want to overwrite a file, it's
important to check wether the file exists before and remove
it in that case.  This was done with 'os.exists' and
'os.remove'.  But this won't work on dangling link.  Thus
the usage of 'lexists' is prescribed for those cases.


* realpath
==========

The method 'realpath' is add to the Filesystem class.

Sometime we need a file to exist.  For example, we need
"/rfs/etc" to exist in order to write to "/rfs/etc/fstab".
Thus, if "/rfs/etc" is a dangling link, we should use the
realpath.  Thus realpath is prescribed for those cases.


* chroot excursion
==================

When entering a target, some files are copy/move around and
restore.  This is hard to track and not scalable.  Thus, a
'chroot excursion' is created uppon entering the context.

The idea is to provide a list of files that we want to copy
from the host to the RFS. We also dictated if we want to
restore those files uppon leaving the context.

This approch is more scalable and less error prone than the
previous hardcoded solution.

Olivier Dion (8):
  Add support for lexists and fix dangling symbolic links
  Add 'realpath' method to 'Filesystem'
  Add save excursion in ChRootFilesystem context
  Check existance of '/rfs/etc/apt/preferences' with 'lexist'
  Check existance of '/rfs/etc/apt/sources.list' with 'lexist'
  Fix 'touch' method of 'VirtApt' on broken link
  Change to 'lexist' for "/etc/apt/{sources.list,preferences}"
  Check if '/rfs/etc' is a link and use realpath

 elbepack/efilesystem.py | 104 ++++++++++++++++++++++++++++++++----------------
 elbepack/filesystem.py  |  45 +++++++++++++++++++++
 elbepack/rfs.py         |  10 ++---
 elbepack/virtapt.py     |  16 ++++----
 4 files changed, 126 insertions(+), 49 deletions(-)

-- 
2.11.0




More information about the elbe-devel mailing list