| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
| |
The implementation of realpath(3) is based on code by Stuart Dootson
(studoot on GitHub).
|
| |
|
|
|
|
|
|
|
|
| |
Reduce the size of the binary by about 32 bytes:
- use xzalloc to allocate static buffers so we don't have to
initialise them;
- avoid duplicated code in spawnveq.
|
|
|
|
|
|
|
|
|
|
|
| |
Moving detection of file formats from access(2) to stat(2) in
commit 650f67507 was acknowledged to slow down stat. One
problematic case is c:/windows/system32 which contains about
2000 DLLs and was found to slow 'ls' unacceptably.
Treat DLLs as a special case in has_exec_format.
See GitHub issue #101.
|
| |
|
|
|
|
|
|
|
|
|
| |
Reading the attributes of files like c:/pagefile.sys fails with
error code ERROR_SHARING_VIOLATION, which breaks 'ls'.
If this happens try an alternative API call to get the attributes.
See GitHub issue #101.
|
|
|
|
|
| |
Since device files are now handled in mingw_open there's no need
for any special treatment in ash redirection.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Handling of the special devices /dev/zero and /dev/urandom was
inconsistent:
- they could be used as arguments to 'cat' but not 'od';
- they could not be used in shell redirection.
Restrict the use of these devices to two places:
- as input files to 'dd' with the 'if=' argument;
- internally within 'shred'.
See GitHub issue #98.
|
| |
|
|
|
|
|
|
|
| |
It appears that uninitialised static variables are placed in the
data section rather than bss, increasing the size of the binary.
Rewrite some code to reduce the amount of static data.
|
|
|
|
|
|
|
|
|
|
|
|
| |
Exclude source files in libbb that aren't used by busybox-w32. This
speeds up the build marginally. They can always be reinstated if
necessary.
Provide fake routines for everything in inode_hash.c so that it
can be excluded. inode_hash.c is now unchanged from upstream.
Use last_char_is in has_exe_suffix_or_dot. It doesn't save any
bytes but it makes the code neater.
|
|
|
|
| |
The only other caller (in spawnveq) has been removed.
|
|
|
|
|
|
|
| |
A filename ending with a dot is a signal to spawnve not to try
adding extensions but to use the name unmodified.
The add_win32_extension function should follow the same rule.
|
|
|
|
|
| |
The has_win_suffix function didn't check that the extension started
with a '.'. As a result the shell was unable to execute cmd.exe.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Move the code to detect shell scripts and binary executables from
mingw_access to a separate function, has_exec_format. Call this function
in do_lstat to decide whether to set the executable bits in the file mode.
This will slow down stat but has a couple of advantages:
- shell scripts are highlighted in ls output
- the test applet can use stat(2) to detect executable files
The new function is used to handle another corner case in spawnveq:
binary executables without the usual .exe extension are only run by
spawnve if the file name ends with '.'.
Two minor changes:
- file_is_win32_executable has been renamed add_win32_extension to
clarify what it does
- a call to file_is_executable has been removed from find_command
in ash as it resulted in unhelpful error messages.
|
|
|
|
|
|
|
| |
Set all mode bits rather than just setting user modes and then
extending them to group and other.
Combine common code in mingw_fstat.
|
|
|
|
|
|
|
|
| |
Support batch files with .bat and .cmd extensions, similar to
what's done for .exe and .com.
Check extensions in the same order as Windows' spawn function:
.com, .exe, .bat, .cmd.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Currently /dev/zero is handled as a special case in dd. Add hacks
to the open and read functions in mingw.c to handle the zero and
urandom devices.
- Opening /dev/zero or /dev/urandom actually opens the special
Windows file 'nul' which behaves like /dev/null. This allows
manipulation of the file descriptor with things like seek and
close
- When /dev/zero or /dev/urandom is opened the resulting file
descriptor is stored and used to override the behaviour of read.
- No attempt is made to track duplicated file descriptors, so using
these devices for redirections in the shell isn't going to work
and won't be permitted. (Could be, but won't.)
- Limited control of the special file descriptors is provided by
allowing the internal variables to be changed.
- The numbers from /dev/urandom aren't very random.
|
|
|
|
|
|
|
| |
The strftime provided by the Microsoft C runtime uses '#' as the
format string flag to remove zero padding; glibc uses '-'.
Support the use of the '-' flag for improved compatibility.
|
|
|
|
|
|
|
|
| |
It may be necessary to run ps as administrator to get information
about processes belonging to other users.
The code to detect GetTickCount64 at run-time was imported from
Git for Windows.
|
|
|
|
|
|
|
|
| |
Add a function (has_exe_suffix) to replace explicit code to check
if a filename ends with '.exe. or '.com'.
Also shrink code that checks for '.exe' or '.com' on PATH in shell's
find_command function.
|
|
|
|
| |
Don't expect sleeping for fractions of a second to be very accurate.
|
|
|
|
|
|
|
|
|
|
|
| |
tail failed to process input from a pipe correctly:
$ echo -n 54321 | tail -c 3
543
It was trying to use lseek as an optimisation but WIN32 lseek doesn't
return an error whan applied to a pipe. Fix this by providing a wrapper
for lseek.
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
| |
Windows' strftime prints the name of the timezone rather than the
timezone offset for '%z'. Add a hack to do it properly.
Windows' strftime also uses its own version of the timezone name for
'%Z'. A workaround for this is to set the TZ environment variable.
|
|
|
|
| |
Make 'ls c:' and 'ls c:/*' do the right thing.
|
|
|
|
|
|
|
| |
Commit 69f49ea imported a setitimer implementation from git. Since
setitimer isn't used at all in BusyBox it can be removed. The same
technique could be used to implement alarm but nothing in the WIN32
port uses that (yet).
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
| |
This makes it possible to enable the id and groups applets,
though the results they return are worthless.
|
|
|
|
| |
This allows the shell to expand ~user.
|
|
|
|
|
|
|
|
|
|
| |
mingw64 handles globbing differently from mingw32. Add code to allow
globbing to be enabled. (By default mingw64 has globbing disabled,
though the default can be changed when it's compiled.)
Also change the configuration option from ENABLE_NOGLOB to
ENABLE_GLOBBING, because double negatives make me think too much.
The default is still for globbing to be disabled.
|
|
|
|
|
|
|
|
|
| |
The read-only attribute on a directory in Microsoft Windows is
quite different from write permission in POSIX. Modify rmdir(2)
and chmod(2) to provide more POSIX-like behaviour:
rmdir will remove a directory even if it's read-only
chmod won't make a directory read-only
|
|
|
|
|
|
|
|
|
|
|
| |
Changing the fake uid from 0 to 1000 uncovered a problem with file
access checks in test. Previously the tests were short-circuited
because it thought we were root. With a non-root user the tests
were performed, but the mode bits had been redefined for WIN32.
Also adjust the fake file mode returned by stat so that the user
and group modes are identical. Other users have the same modes
as user but without write permission.
|
| |
|
|
|
|
|
|
|
|
| |
Various fake POSIX routines returned different values for uid/gid:
getuid/getgid used 1, stat used 0 and getpwuid used 1000. Standardise
on 1000.
Also, add fake getgrgid.
|
| |
|
| |
|
|
|
|
|
| |
On POSIX platforms bb_got_signal is defined in libbb/signals.c; for
MinGW put the definition in win32/mingw.c. This is better than the
|
|
|
|
|
|
|
|
|
|
|
| |
Microsoft Windows has a strange issue with access permissions such that
mkdir will sometimes return EACESS for an existing directory. This is
mentioned here:
http://www.apijunkie.com/APIJunkie/blog/post/2009/12/22/_mkdir-C-runtime-library-function-might-return-unexpected-error-values.aspx
This was causing mkdir -p to fail on a particular machine. Ignoring the
EACCES error if the directory exists fixes the problem.
|
|
|
|
|
|
| |
This may address:
https://github.com/rmyorston/busybox-w32/issues/25
|
|
|
|
|
|
| |
Microsoft Windows ignores the read-only attribute on directories and
has no equivalent to the Unix execute permission on directories.
Treat all directories as writable and searchable.
|
| |
|
|
|
|
|
|
|
| |
Conflicts:
debianutils/which.c
editors/vi.c
libbb/executable.c
|
| |
|