Jefiya MJ created FELIX-6855:
--------------------------------

             Summary: [FILEINSTALL] Prevent duplicate *.cfg files in 
subdirectories from corrupting live OSGi configurations- #544
                 Key: FELIX-6855
                 URL: https://issues.apache.org/jira/browse/FELIX-6855
             Project: Felix
          Issue Type: Bug
          Components: File Install
            Reporter: Jefiya MJ


When `felix.fileinstall.subdir.mode = recurse` is active, FileInstall scans all 
subdirectories under the watched root and registers every matching file as an 
OSGi Configuration object.

Both `setConfig()` and `deleteConfig()` derive the ConfigurationAdmin PID from 
the filename alone via `parsePid(f.getName())`, discarding the directory path 
entirely. This means any two files with the same name —
regardless of where they sit in the directory tree — resolve to the same PID.

Consequences:

- If a file with the same name as a live configuration is copied into a 
subdirectory, `setConfig()` overwrites the live configuration's 
`felix.fileinstall.filename` property with the duplicate file's URI, silently 
stealing ownership.

- When the duplicate file is later deleted, `deleteConfig()` resolves the same 
PID and calls `config.delete()` on the live Configuration object — removing it 
from ConfigurationAdmin even though the original physical file was never 
touched. Dependent OSGi services stop immediately and cannot restart.
Raised a Pr: https://github.com/apache/felix-dev/pull/544



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to