Q: How to prevent inode change when working on a remote server hard-linked file via SFTP access ?

Open
#680 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
25/100
Issue type
Bug
Clarity
Needs clarification
Activity status
Stale
Tech stack
c
Domain
desktop

Research direction

No source file, test, or entry point is named. Start by tracing how Xed edits files opened through Nemo and SFTP, then determine whether the inode change occurs in Xed or in the SSH/SFTP path; done means identifying the responsible component and documenting or resolving the hard-link behavior.

Written by the indexing model from the issue text.

Description

Hi,

I am working on a remote server using scripts "harld-linked" in different locations.

When using SSH + server's local 'nano' editor, everything is okay (meaning hardlinks ensure that the same file content is served everywhere needed).

When I utilised 'Xed' from my client computer via SFTP (through 'Nemo' <<= This adds it to the who's "fault" ? question, right now), I noticed that the inode of the original file on the server is changed despite being a "hard-linked" file.

I wonder if 'Xed' code needs little help to handle this situation better (like if editing a "hrdlinked" file from the system 'Xed' is ran) or if I should have a look at either SSH, SFTP or 'Nemo' configuration to establish a network link to the remote system allowing 'Xed' to work like if on my client PC where 'Xed' resides.

Someone may say that I should better use "soft-links"... (May be, for now... 🤔)
BUT, what about system files "hard-linked" out of the box by software / OS freshly installed and then, after a quick edit, nothing works as expected and ends into many hours of "bug tracking" ?

Well, please let me know if it's possible to address the issue from 'Xed' 's side or not.
Thank you for reading me until there.

Best regards,
HP_

P.S.
Some things I came across during a "quick" search:

#! /bin/bash
file_to_access='/path/to/file/file_name'
file_inode=`ssh ${user}@${server} ls -i  ${file_to_access} | cut -d' ' -f1`
# Now, need an equivalent using the already open SFTP connection
# Would it suffice to help ? 🤔 

P.P.S.
I also gave a try to read the inode of same "hard-linked" files via a MergerFS mount on the same server, the specially crafted inode value by MergerFS matches for all locations tested.
This means that 'Xed' could (should?) be able to work around the issue I faced if able to get same information provided by:
ssh user@server ls -li /path/to/file/filename
and lokking at field 1 (inode_value) and 3 (links count), right ?

Dominant language
C
Stars
551
Forks
115
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from linuxmint/xed

All issues in linuxmint/xed

Similar issues

More C issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.