Skip to content

Commit

Permalink
Edits
Browse files Browse the repository at this point in the history
  • Loading branch information
forsyth2 committed Apr 19, 2023
1 parent c92453a commit 04b113b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
7 changes: 0 additions & 7 deletions zstash/hpss_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,17 +178,10 @@ def add_file(

# FIXME: error: "TarFile" has no attribute "offset"
offset: int = tar.offset # type: ignore
print(f"file_name={file_name}")
print(f"is_link={os.path.islink(file_name)}")
if os.path.islink(file_name):
linked_file_name = os.path.realpath(file_name)
print(f"realpath file_name={linked_file_name}")
print(f"cwd={os.getcwd()}")
print(f"ls={os.listdir()}")
os.remove(file_name) # Remove symbolic link and create a hard copy
# TODO: see where FileNotFoundError is getting caught such that `create` continues on.
shutil.copy(linked_file_name, file_name)
print(os.listdir())
tarinfo: tarfile.TarInfo = tar.gettarinfo(file_name)
# Change the size of any hardlinks from 0 to the size of the actual file
if tarinfo.islnk():
Expand Down
3 changes: 3 additions & 0 deletions zstash/ls.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,9 @@ def ls_database(args: argparse.Namespace, cache: str) -> List[FilesRow]:
)
matches_ = matches_ + cur.fetchall()

if matches_ == []:
raise FileNotFoundError("There was nothing to extract.")

# Remove duplicates
matches_ = list(set(matches_))
matches: List[FilesRow] = list(map(FilesRow, matches_))
Expand Down

0 comments on commit 04b113b

Please sign in to comment.