# Buggy code
def set_case_sensitive_readwrite(self, subdir):
    """Determine if directory at rp is case sensitive by writing"""
    assert not self.read_only
    upper_a = subdir.append("A")
    upper_a.touch()
    lower_a = subdir.append("a")
    if lower_a.lstat():
        lower_a.delete()
        upper_a.setdata()
        assert not upper_a.lstat()
        self.case_sensitive = 0
    else:
        upper_a.delete()
        self.case_sensitive = 1


# Traceback (exceptions.AssertionError)
Message: Found interrupted initial backup. Removing...
Exception '' raised of class '<type 'exceptions.AssertionError'>':
File "/usr/local/lib/python2.7/dist-packages/rdiff_backup/Main.py", line 306, in error_check_Main
try: Main(arglist)
File "/usr/local/lib/python2.7/dist-packages/rdiff_backup/Main.py", line 326, in Main
take_action(rps)
File "/usr/local/lib/python2.7/dist-packages/rdiff_backup/Main.py", line 282, in take_action
elif action == "backup": Backup(rps[0], rps[1])
File "/usr/local/lib/python2.7/dist-packages/rdiff_backup/Main.py", line 336, in Backup
rpout.conn.fs_abilities.backup_set_globals(rpin, force)
File "/usr/local/lib/python2.7/dist-packages/rdiff_backup/fs_abilities.py", line 959, in backup_set_globals
dest_fsa = FSAbilities('destination').init_readwrite(Globals.rbdir)
File "/usr/local/lib/python2.7/dist-packages/rdiff_backup/fs_abilities.py", line 156, in init_readwrite
self.set_case_sensitive_readwrite(subdir)
File "/usr/local/lib/python2.7/dist-packages/rdiff_backup/fs_abilities.py", line 304, in set_case_sensitive_readwrite
assert not upper_a.lstat()

Traceback (most recent call last):
File "/usr/local/bin/rdiff-backup", line 30, in <module>
rdiff_backup.Main.error_check_Main(sys.argv[1:])
File "/usr/local/lib/python2.7/dist-packages/rdiff_backup/Main.py", line 306, in error_check_Main
try: Main(arglist)
File "/usr/local/lib/python2.7/dist-packages/rdiff_backup/Main.py", line 326, in Main
take_action(rps)
File "/usr/local/lib/python2.7/dist-packages/rdiff_backup/Main.py", line 282, in take_action
elif action == "backup": Backup(rps[0], rps[1])
File "/usr/local/lib/python2.7/dist-packages/rdiff_backup/Main.py", line 336, in Backup
rpout.conn.fs_abilities.backup_set_globals(rpin, force)
File "/usr/local/lib/python2.7/dist-packages/rdiff_backup/fs_abilities.py", line 959, in backup_set_globals
dest_fsa = FSAbilities('destination').init_readwrite(Globals.rbdir)
File "/usr/local/lib/python2.7/dist-packages/rdiff_backup/fs_abilities.py", line 156, in init_readwrite
self.set_case_sensitive_readwrite(subdir)
File "/usr/local/lib/python2.7/dist-packages/rdiff_backup/fs_abilities.py", line 304, in set_case_sensitive_readwrite
assert not upper_a.lstat()
AssertionError

# Fixed code
def set_case_sensitive_readwrite(self, subdir):
    """Determine if directory at rp is case sensitive by writing"""
    assert not self.read_only
    upper_a = subdir.append("A")
    upper_a.touch()
    lower_a = subdir.append("a")
    if lower_a.lstat():
        lower_a.delete()
        upper_a.setdata()
        if upper_a.lstat():
            # we know that (fuse-)exFAT 1.3.0 takes 1sec to register the
            # deletion (July 2020)
            log.Log.FatalError(
                "We're sorry but the target file system at '%s' isn't "
                "deemed reliable enough for a backup. It takes too long "
                "or doesn't register case insensitive deletion of files."
                % subdir.get_safepath()
            )
        self.case_sensitive = 0
    else:
        upper_a.delete()
        self.case_sensitive = 1