7.3 Adjust logging of inline FILE execution#2422
Conversation
WalkthroughImplements per-FILE inline script handling by assigning a unique temp filename per file, writing INLINE content to it, logging execution, running it via an escaped command string, and removing the temp file afterward. Replaces the prior static /tmp/inline.sh usage and generic logging. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor User
participant PluginManager as Plugin Manager
participant Parser as FILE/INLINE Parser
participant FS as Temp FS
participant Shell as Shell
User->>PluginManager: Install/Process plugin
PluginManager->>Parser: Iterate FILE elements
loop For each FILE
Parser->>PluginManager: INLINE content detected
note over PluginManager: Increment current_file
PluginManager->>FS: Create temp script path (per-file)
PluginManager->>FS: Write INLINE content
PluginManager->>PluginManager: Build escaped command
PluginManager->>Shell: Execute temp script
Shell-->>PluginManager: Exit status
PluginManager->>FS: Remove temp script
end
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches🧪 Generate unit tests (beta)
Comment |
🔧 PR Test Plugin AvailableA test plugin has been generated for this PR that includes the modified files. Version: 📥 Installation Instructions:Install via Unraid Web UI:
Alternative: Direct Download
|
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
emhttp/plugins/dynamix.plugin.manager/scripts/plugin (1)
466-471: Excellent improvements to security, logging, and collision prevention.The changes successfully address the PR objectives:
- Unique temp filenames prevent collisions when multiple inline scripts execute (including the edge case of nested plugin installations)
- Enhanced logging clearly indicates which plugin and FILE section is executing
escapeshellarg()properly prevents command injection vulnerabilitiesConsider applying the same content handling used for named INLINE files for consistency:
- file_put_contents($name, $file->INLINE); + $contents = trim($file->INLINE).PHP_EOL; + file_put_contents($name, $contents);This ensures shell scripts have a trailing newline, following the same pattern used at lines 404-405.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
emhttp/plugins/dynamix.plugin.manager/scripts/plugin(2 hunks)
🔇 Additional comments (1)
emhttp/plugins/dynamix.plugin.manager/scripts/plugin (1)
345-347: LGTM! Counter implementation is correct.The per-file counter initialization and increment logic is properly placed and will provide unique identifiers for each FILE element, starting from 1.
For 7.3.
Adjust logging during plugin installation / update / removal to indicate the plugin and FILE section being executed.
Support edge case of a plugin installing another plugin via inline FILE
Summary by CodeRabbit