Skip to content
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

Remove "tools.syncfs()" #1685

Closed
buhtz opened this issue Apr 13, 2024 · 0 comments · Fixed by #1698
Closed

Remove "tools.syncfs()" #1685

buhtz opened this issue Apr 13, 2024 · 0 comments · Fixed by #1698
Assignees
Labels
Discussion decision or consensus needed Low relevant, but not urgent

Comments

@buhtz
Copy link
Member

buhtz commented Apr 13, 2024

backintime/common/tools.py

Lines 1539 to 1547 in d33f35e

def syncfs():
"""
Sync any data buffered in memory to disk.
Returns:
bool: ``True`` if successful
"""
if checkCommand('sync'):
return(Execute(['sync']).run() == 0)

I vote to remove that function because there is no appropriated use case for it. It simply execute sync on the shell to make sure the file system is "synced" (flushed).

Checking via grep it seems to be used only in tools.shutdown():

backintime/common/tools.py

Lines 2223 to 2241 in d33f35e

def shutdown(self):
"""
Run 'shutdown -h now' if we are root or
call the dbus proxy to start the shutdown.
"""
if not self.activate_shutdown:
return(False)
if self.is_root:
syncfs()
self.started = True
proc = subprocess.Popen(['shutdown', '-h', 'now'])
proc.communicate()
return proc.returncode
if self.proxy is None:
return(False)
else:
syncfs()
self.started = True
return(self.proxy(*self.args))

The shutdown command on shell itself is designed to make sure the shutdown is clean and healthy. This includes a synced/valid state of the file system.

Don't forget to remove the unit tests, too.

@buhtz buhtz self-assigned this Apr 13, 2024
@buhtz buhtz added Discussion decision or consensus needed Low relevant, but not urgent labels Apr 13, 2024
@buhtz buhtz added this to the Upcoming release (1.5.0) milestone Apr 13, 2024
buhtz added a commit that referenced this issue May 1, 2024
Was used in shutdown() only. Shutodwn cause an unmount which itself cause synfs on OS level. No need for BIT to do it explicit. Behavior of BIT do not change.

Additionally minor PEP8 improvements.

Close #1685
dw4102 pushed a commit to dw4102/backintime that referenced this issue May 4, 2024
Was used in shutdown() only. Shutodwn cause an unmount which itself cause synfs on OS level. No need for BIT to do it explicit. Behavior of BIT do not change.

Additionally minor PEP8 improvements.

Close bit-team#1685

Finish rpmbuild & specfile creation

feat: RPM package building support
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Discussion decision or consensus needed Low relevant, but not urgent
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant