-
Notifications
You must be signed in to change notification settings - Fork 606
[BREAKING] system/dd: using system dd to instead nsh dd, avoid duplicate code #3057
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
align nshlib/nsh_cmddd Signed-off-by: dongjiuzhu1 <[email protected]>
nshlib/cmd_dd: Retry if read() was interrupted Without this patch nsh> ls /etc/group | dd | dd sh [13:100] sh [14:100] nsh: dd: read failed: 4 nsh> Signed-off-by: wangjianyu3 <[email protected]> Signed-off-by: dongjiuzhu1 <[email protected]>
[Experimental Bot, please feedback here] No, this PR summary does not adequately meet the NuttX requirements. Here's why and how to fix it:
Example of improved summary:
nsh> dd if=/dev/zero of=/dev/null bs=512 count=10
nsh> dd if=/dev/zero of=/dev/null bs=512 count=10
By providing more specific information, you significantly increase the chances of your PR being reviewed and merged quickly. Remember to replace the example details with your actual information. |
cmd_dd:support dd can do verify After writing the file, compare the contents of the two files again Signed-off-by: anjiahao <[email protected]> Signed-off-by: dongjiuzhu1 <[email protected]>
Signed-off-by: dongjiuzhu1 <[email protected]>
nshlib/dd: Increase the integer width for sector size in dd. On some systems, using sector sizes larger than 65536 is needed for profiling performance or testing. Stuart Ianna <[email protected]> Signed-off-by: dongjiuzhu1 <[email protected]>
ba986e9
to
33bad8e
Compare
We'll change Draft Mode to Ready For Review, after voting has closed. Thanks :-) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @Donny9 :-) My remarks below (marked as RC until discussion / vote is resolved on the mailing list):
- Is it really necessary to remove built-in nsh/dd? What are the benefits over breaking build compatibility with os and apps?
- It is impossible to keep both (i.e. nsh/dd as minimalistic and apps/system/dd as fully featured) as exclusive selections?
- Why not extend nsh/dd with new features while keep the minimal as default?
- Aside question did NuttX consider
/usr/bin/dd
versus built-indd
(something like built-intime
versus/usr/bin/time
in Unix)? - Documentation needs an update in either case :-P
@cederom @lupyuen @Donny9 comparing both file with meld I can see they are basically the same code:
But I think system/dd will evolve to be more complete and compatible with Linux/Unix over the time. For example, nsh_ddcmd.c has CONFIG_NSH_CMDOPT_DD_STATS that doesn't exist in system/dd, so it rings a bell that system/dd is more focused on compatibility vs code size. I think that CONFIG_NSH_CMDOPT_DD_STATS could be renamed to CONFIG_SYSTEM_DD_MINIMUM and included in other parts there that aren't essential for a simple dd command. |
This causes a regression when NSH_FILEAPPS=y, as the full path to /bin/dd must be provided. I'm okay with this, since I put /bin into PATH, but others might not. Just something to keep in mind. |
using system/dd to instead nsh dd cmd remove related to config, file. Signed-off-by: dongjiuzhu1 <[email protected]>
Done~ rename CONFIG_NSH_CMDOPT_DD_STATS to CONFIG_SYSTEM_DD_STATS. |
@Donny9 Please close the voting. Thanks!
|
@cederom Firstly, we need to ensure that only one implementation of dd is retained in NuttX, because having two implementations would increase complexity for developers in terms of choosing which one to use. Moreover, if there are two versions, it could lead to misalignment in dd functionality, resulting in more maintenance work and complaints. I understand that the original reason for introducing the built-app version of dd was that it allowed for independent stack space settings, making it convenient to observe the stack consumption by the file system(If the stack consumed by dd is excessively large, it will result in a larger stack for nsh, thereby reducing the available memory for the system. Therefore, a built-app approach would be preferable). In reality, there is no significant difference for developers between the built-app dd and the command-line dd. Furthermore, there are indeed many other commands in the system that exist as built-apps, such as tar, ssh, scp, sb, rb, etc.
As mentioned above, having two implementations of dd is highly undesirable. As for the extent to which the simplified version of dd lacks functionality compared to the full version, it is difficult to gauge.
In my opinion, their main differences are as follows:
Done |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @Donny9 :-)
Happy Easter :-) :-)
Summary
system/dd: using system dd to instead nsh dd, avoid duplicate code, and keep function align with nsh dd.
Impact
remove dd config: NSH_DISABLE_DD/NSH_CMDOPT_DD_STATS
enable SYSTEM_DD when !DEFAULT_SMALL(keep dd cmd always enable)
Testing
sim:nsh