Added the 'sync' command which attempts to reload the current target
Added a sync command to target-shell which attempts to invalidate the current target by recursively looping over all dissect.* attributes and looks for @lru_cache entries to invalidate with a max-depth of 8. Should help in situations where the a live target (i.e.: a vm) has synced, but the target-shell hasn't, leading to an inconsistent state.
Codecov Report
Attention: Patch coverage is 3.12500% with 31 lines in your changes missing coverage. Please review.
Project coverage is 75.10%. Comparing base (
b1bcb0d) to head (c1f5548). Report is 86 commits behind head on main.
| Files with missing lines | Patch % | Lines |
|---|---|---|
| dissect/target/tools/shell.py | 3.12% | 31 Missing :warning: |
Additional details and impacted files
@@ Coverage Diff @@
## main #694 +/- ##
==========================================
- Coverage 75.19% 75.10% -0.10%
==========================================
Files 292 292
Lines 24836 24868 +32
==========================================
+ Hits 18676 18677 +1
- Misses 6160 6191 +31
| Flag | Coverage Δ | |
|---|---|---|
| unittests | 75.10% <3.12%> (-0.10%) |
:arrow_down: |
Flags with carried forward coverage won't be shown. Click here to find out more.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
Hi @Paradoxis,
I was so in awe by your TED talk that it took me 5 months to recover and be able to reply to your PR!
While a nice contribution, the proposed method is not something we'd like to explore further. Instead, I think it'd be better to implement a reload command in target-shell, that simply reloads the Target object with the same path. Note that this will only work Target objects that have been instantiated from a path, and not custom created ones. But we could guard against that by checking if .path is None.
Reloading the entire target object is more heavy, but it should ensure any and all caches and intermediate states are properly cleared.
Hi @Paradoxis,
I was so in awe by your TED talk that it took me 5 months to recover and be able to reply to your PR!
While a nice contribution, the proposed method is not something we'd like to explore further. Instead, I think it'd be better to implement a
reloadcommand intarget-shell, that simply reloads theTargetobject with the same path. Note that this will only workTargetobjects that have been instantiated from a path, and not custom created ones. But we could guard against that by checking if.pathisNone.Reloading the entire target object is more heavy, but it should ensure any and all caches and intermediate states are properly cleared.