rmyorston / busybox-w32

WIN32 native port of BusyBox.
https://frippery.org/busybox
Other
693 stars 126 forks source link

How many lines of code are supported by custom scripts in embed directory? #439

Closed HuangShumin closed 2 months ago

HuangShumin commented 2 months ago

Hello,

Recently I put a long scripts in embed/long_scripts, I found it won't be complied in busybox.exe, but it exists in include/applets.h

Is there any limitation for custom scripts?

Best Regards.

rmyorston commented 2 months ago

I'm not aware of any limitation on the number of lines of code in an embedded script.

I made a trivial long script like so:

echo 'cat <<"EOF"' >embed/long_script
xxd busybox.exe    >>embed/long_script
echo EOF           >>embed/long_script

It worked as expected.

HuangShumin commented 2 months ago

hmm, the problem seems to be Windows build.

echo 'cat <<"EOF"' >embed/long_script
xxd busybox.exe    >>embed/long_script
echo EOF           >>embed/long_script

This can be reproduced in w64devkit @skeeto , after the building, ./busybox --list -full | grep long_script, there's nothing such applet.

rmyorston commented 2 months ago

My initial attempt at reproducing the problem was on Linux. I've now tried w64devkit 2.0.0, both 32 and 64 bit, and can't reproduce the issue there either.

Since I had a hand in writing scripts/embedded_scripts I'm quite prepared to believe it may be faulty. I don't currently see how, though.

After an attempt to build a binary with long_script included what is the result of this command?

$ grep long_script include/* 2>/dev/null
include/applet_tables.h:"long_script" "\0"
include/applet_tables.h:#define APPLET_NO_long_script 77
include/applets.h:IF_FEATURE_SH_EMBEDDED_SCRIPTS(APPLET_SCRIPTED(long_script, scripted, BB_DIR_USR_BIN, BB_SUID_DROP, scripted))
include/embedded_scripts.h:     APPLET_NO_long_script,
$ 
HuangShumin commented 2 months ago

Yes, I have the same sympton as you just reproduced:

grep long_script include/* 2>/dev/null
include/applet_tables.h:"long_script" "\0"
include/applet_tables.h:#define APPLET_NO_long_script 77
include/applets.h:IF_FEATURE_SH_EMBEDDED_SCRIPTS(APPLET_SCRIPTED(long_script, scripted, BB_DIR_USR_BIN, BB_SUID_DROP, scripted))
include/embedded_scripts.h:     APPLET_NO_long_script,

I believe it's caused by some utility called by building scripts.

rmyorston commented 2 months ago

The results of your grep look correct. I don't know why you don't have the long_script applet.

HuangShumin commented 2 months ago

I don't know if it's my version problem of w64devkit or not. I installed w64devkit 2.0, I cannot reproduce this issue anymore. This case will be closed first and reopen it when new clue appears.