Bug 177079 - Updating fstab fails if /etc and /tmp are on different filesystems
Summary: Updating fstab fails if /etc and /tmp are on different filesystems
Keywords:
Status: CLOSED DUPLICATE of bug 175131
Alias: None
Product: Red Hat Enterprise Linux 4
Classification: Red Hat
Component: system-config-lvm
Version: 4.0
Hardware: i386
OS: Linux
medium
medium
Target Milestone: ---
: ---
Assignee: Jim Parsons
QA Contact:
URL:
Whiteboard:
Depends On: 175131
Blocks:
TreeView+ depends on / blocked
 
Reported: 2006-01-06 01:35 UTC by Håvard Lygre
Modified: 2009-04-16 23:12 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2006-05-15 16:39:49 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Håvard Lygre 2006-01-06 01:35:11 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.10) Gecko/20050914 Firefox/1.0.4 (Debian package 1.0.4-2sarge4)

Description of problem:
s-c-l updates fstab by creating a modified version in /tmp/fstab and _renaming_ (os.rename) it to /etc/fstab.  This does not work when /tmp and /etc are on different filesystems.  Everything else works (the LV is created, the filesystem is created and mounted on correct mountpoint), but the application hangs after this error. 

Traceback (most recent call last):
  File "/usr/share/system-config-lvm/InputController.py", line 645, in on_new_lv    if dlg.run() == False:
  File "/usr/share/system-config-lvm/InputController.py", line 1324, in run
    if self.apply() == True:
  File "/usr/share/system-config-lvm/InputController.py", line 2002, in apply
    Fstab.add(lv_path, mountpoint_new, filesys_new.name)
  File "/usr/share/system-config-lvm/Fstab.py", line 33, in add
    os.rename(FSTAB_TMP, FSTAB)
OSError: [Errno 18] Invalid cross-device link


The same problem occurs if you try to remove an LV, however then the app crashes before being able to do anything (as editing fstab is probably the first thing that happens).

Using shutil.move instead of os.rename fixes the problem for me.

--- Fstab.py.old        2005-09-13 16:46:05.000000000 +0200
+++ Fstab.py    2006-01-06 02:32:05.000000000 +0100
@@ -1,6 +1,7 @@

 import sys
 import os
+import shutil

 import Filesystem

@@ -30,12 +31,12 @@
     fstab.write(line)
     fstab.close()

-    os.rename(FSTAB_TMP, FSTAB)
+    shutil.move(FSTAB_TMP, FSTAB)

 def remove(mnt_point):
     fstab = __remove(mnt_point)
     fstab.close()
-    os.rename(FSTAB_TMP, FSTAB)
+    shutil.move(FSTAB_TMP, FSTAB)

 def __remove(mnt_point):
     fstab = open(FSTAB, 'r')


Version-Release number of selected component (if applicable):
system-config-lvm-1.0.5-1.0

How reproducible:
Always

Steps to Reproduce:
/etc and /tmp on different filesystems.  Create a new LV, and ask s-c-l to mount after reboot (so it updates the fstab).

Actual Results:  The application crashes, having performed some of the tasks.

Additional info:

Comment 2 Stanko Kupcevic 2006-05-15 16:39:49 UTC
Fixed in 1.0.17

*** This bug has been marked as a duplicate of 175131 ***


Note You need to log in before you can comment on or make changes to this bug.