bzip2: Input file file.txt has 1 other link
Asked Answered
D

2

9

When calling

bzip2 file.txt

I get this error message

bzip2: Input file file.txt has 1 other link

I'm using OSX, but I think this problem is not specific to OSX, so I'm asking here.

Dacoit answered 2/9, 2015 at 13:56 Comment(1)
On Windows 11 I get the same even with Google Drive in synchronization pause, but if I exit Google Drive then it works. Could be a similar sync process on macOS.Murcia
E
16

I solved it using the force flag: -f

Don't know why.

Entremets answered 14/11, 2015 at 11:18 Comment(4)
I don't know if bzip2 write to the same file handle it reads from. If it does, which it presumably does to make you use the force flag for linked files, it's probably a good idea to use -fk to keep the old file as it was.Rupture
It happened to me as well. It seems it's because Google Drive was also syncing this file at the same time. Check if this directory is synced by Dropbox or any other software, that could explain why it's used.Oakland
I wonder if this can happen also with files which were synced in the past but now they stopped to be synced. The link issue happened to me inside such folder which is not part of GDrive/OneDrive anymore.Chandrachandragupta
This worked for me in a NTFS filesystem mounted on LinuxJudy
D
0

My solution was to copy the file:

cp file.txt tmp
rm file.txt
mv tmp file.txt
bzip2 file.txt

But perhaps someone could explain it anyway?

Dacoit answered 2/9, 2015 at 14:2 Comment(2)
It happens because file.txt has a hard link to another file. There's a discussion about it here: jeremy.zawodny.com/blog/archives/010745.htmlMclin
Just discovered that this can happen when the file is no link at all also, at least in MacOs. -f flag helps anyway there.Moen

© 2022 - 2024 — McMap. All rights reserved.