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

dion at linutronix.de dion at linutronix.de
Wed May 22 15:33:40 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 file 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 with 'lexist' for "/rfs/etc"

 elbepack/efilesystem.py | 77 ++++++++++++++++++++++++++-----------------------
 elbepack/filesystem.py  |  6 ++++
 elbepack/rfs.py         | 10 +++----
 elbepack/virtapt.py     | 16 +++++-----
 4 files changed, 59 insertions(+), 50 deletions(-)

-- 
2.11.0




More information about the elbe-devel mailing list