This reverts commit 04b9ca8c31.
The original incarnation of this patch was falsely triggering when our
poll would block with no activity happening for an extended amount of
time. When the poll returned, we would immediately flag that as a spin
loop. Solve this by tracking the last time we looped, to detect this.
While we're at it, switch from CLOCK_MONOTONIC to CLOCK_BOOTTIME, for
the same reason.
Change-Id: Ibcdf69d93f7b6012142cafd72066f39494c1f84b
Test: ./test_device.py
Removed call to external aapt2 process
Replaced several layers of error handling with calls to fatal()
Changed output messages for failures to be more useful for diagnostics
Bug: 116753196
Test: mm
Test: adb install -r --fastdeploy --force-agent --local-agent ~/example_apks/example.apk
Test: adb install -r --fastdeploy --no-streaming --force-agent --local-agent ~/example_apks/example.apk
Change-Id: I6006d8aa584e789a086a31e79a41d1416e54402a
The standard (RFC 1122 - 4.2.2.13) says that if we call close on a
socket while we have pending data, a TCP RST should be sent to the
other end to notify it that we didn't read all of its data. However,
this can result in data that we've succesfully written out to be dropped
on the other end. To avoid this, instead of immediately closing a
socket, call shutdown on it instead, and then read from the file
descriptor until we hit EOF or an error before closing.
Bug: http://b/74616284
Test: ./test_adb.py
Test: ./test_device.py
Change-Id: I36f72bd14965821dc23de82774b0806b2db24f13
Currently `adb remount` won't remount symlink mount points.
In Android Generic System Image, there is a symlink
/product -> /system/product for devices with and without a physical
/product partition to work, respectively:
- Mount product partition under /system/product via
'mount /product' OR
- Keep using /product -> /system/product symlink,
when no product partition
Currently find_proc_mount() is seeking "/product" under /proc/mounts.
But the actual mount path is "/system/product" when GSI is used
on a device with product partition.
Bug: 111539442
Test: adb remount && touch /product/abc on both GSI and non-GSI
Change-Id: I8f15a67109d0a3f4ee18596ef7eb4280c5631b11
Also stop using size_t (which will be 32-bit on Win32) for offsets in
adb_sideload_host, and stop truncating large file sizes in our
"sideload-host" messages.
Bug: http://b/112003354
Test: builds
Change-Id: If5b7cc9d1fc7ff7ca6eaebd20418f7b061846203
Implement a version of fdevent_destroy that returns the file descriptor
previously owned by the fdevent, instead of closing it.
Bug: http://b/74616284
Test: treehugger
Change-Id: I6a14ac96e6b8c801bc71bfcc9094851c158510ae
It was doing a test with `[ -d foo`, without the closing square bracket.
Test: python -m unittest test_device.FileOperationsTest.test_push_empty
Change-Id: I996b98850cf916986ef969768a7235547fcc404a
We can not mount overlayfs on root / as it will intercept all file
transactions. Thus must remount /system instead.
Test: manual
Bug: 109821005
Bug: 115751838
Change-Id: Idf646b8c1ca8a0d006bf64e23a76a7e909f9162a
Add an fstab argument for fs_mgr_overlayfs_mount_all so that it can
leverage the locally and timely acquired fstab entries. Affects all
callers, adb and init.
Test: manual
Bug: 109821005
Bug: 115751838
Change-Id: I96e2045d88525a6ce39bef63327a0fcf0704e9bc
Devices not supporting logical partitions do not require the command.
Bug: 78793464
Test: 'adb reboot fastboot' reboots to bootloader for a device
not supporting logical partitions.
Change-Id: I0a7b6d4335040e24efbf461e2dd2d56ab1985b7f
Bug: http://b/91353691
- libcxx has ETXTBSY for Windows
- adb/sysdeps/memory.h is no longer needed
Test: Build and test Windows binaries under Wine.
Change-Id: I9c27087d46c49cb25b391c4adae8d9e24724784d
For symmetry with test_adb.py, since they have different interpreter
requirements now.
Test: ./test_device.py
Change-Id: I02fe659a7216a619383661c8019d356f9ccfb34d
The system image is now a root image, even on devices that don't use
system-as-root. Fix remount to always remount /, to account for this.
Bug: http://b/115751838
Test: `adb remount; adb shell mount | grep " / "`
Change-Id: I2d89a795bd0bc53af33fe69c9d049bbb64d26f3b
Removed support for -f shortcut flag as this conflicts with some package manager flags
Renamed use_localagent global to match conventions
Fixed case where tmp files were created unnecessarily
Removed dead code (delete_host_file)
Cleaned up multiple layers of error handling by using fatal() as soon as error conditions occur
Fix: 113631900
Test: mm
Test: adb install -r --fastdeploy --nostreaming --force-agent --local-agent ~/example_apks/example.apk
Test: adb install -r --fastdeploy --no-streaming --force-agent --local-agent ~/example_apks/example.apk
Test: observe that fast deploy works as usual
Test: adb install -r -f --nostreaming --force-agent --local-agent ~/example_apks/example.apk
Test: adb install -r -f --no-streaming --force-agent --local-agent ~/example_apks/example.apk
Test: observe that fast deploy is no longer invoked by -f
Change-Id: Ic719df1003ac319e48b32f7f377f6f91d17f6a6f
(cherry picked from commit 0584689beaff604ceeccaf706dc368213d07b977)
deploypatchgenerator is now a dependency of adb
deployagent is now a java_binary target and uses the built in 'wrapper' parameter to bundle deployagent.sh
fastdeploy.cpp code in adb modified to reference deployagent rather than deployagent.sh (required to work with built in wrapper functionality).
removed near-redundant fastdeploy_init and TFastDeployConfig singleton as per:
https://android-review.googlesource.com/c/platform/system/core/+/740521/12/adb/client/fastdeploy.cpp#36
relocated kFastDeployMinApi to more appropriate location
Test: rm -rf $ANDROID_ROOT/out
Test: make sdk -j40
Test: find out/ -iname deploypatchgenerator
Test: observe that deploypatchgenerator.jar has been built as a dependency of the sdk target
Test: mm
Test: adb install -r -f --force-agent --local-agent ~/example_apks/example.apk
Test: adb install -r -f --no-streaming --force-agent --local-agent ~/example_apks/example.apk
Change-Id: I4e52d32f87774b44845bf6b5be0bae331a0b2324
Use a new Windows 10 API, SetThreadDescription(). Background info from a Chrome developer:
https://randomascii.wordpress.com/2015/10/26/thread-naming-in-windows-time-for-something-better/
Test: Win10, Vista, adb shell
Test: Ran windbg -pn adb.exe, used .dump /ma to create a dump, ran
`dx -g @$curprocess.Threads' on the dump and it showed the thread names.
Change-Id: I14ea7121605cb3fa45ce7b59e2ba5882a215b59f
Signed-off-by: Spencer Low <CompareAndSwap@gmail.com>
The code was passing an fd from adb_open() to android::base::ReadFdToString() which actually
takes a C-Runtime fd (on Windows), so it wasn't working.
The fix is to use APIs that deal with C-Runtime fds:
* unix_open()
* android::base::unique_fd
* unix_lseek() (added in this change)
I also removed an unnecessary call to GetProcessId() since we already have the process id
from the structure returned by CreateProcess().
Test: adb start-server on Win10 and Ubuntu (with a failing server)
Test: mma
Change-Id: Id6e2dd5532a02fe5d9caf96aa007a1b3434a0b59
Signed-off-by: Spencer Low <CompareAndSwap@gmail.com>
Unittest for a5b06b0ff8. Works by
simulating resume from sleep/hibernation by sending a Windows message.
Test: python3 -m unittest test_adb.PowerTest
Change-Id: I78510f30c012f68eda39764da522dbf8d03f2576
Signed-off-by: Spencer Low <CompareAndSwap@gmail.com>
Also fix adb's version number to match.
See build/soong/README.md for more information.
Test: cd system/core/fastboot; mma
Test: fastboot --version
Test: adb --version
Test: out/host/linux-x86/nativetest/fastboot_test/fastboot_test
Test: out/host/linux-x86/nativetest64/fastboot_test/fastboot_test
Change-Id: I65ea39af9183c602e84f3bc0e4a0d066a30fc464
It doesn't seem like b3c14ec693 was really
waiting for adb server death because the server would write OKAY to the
socket, causing the client to return from ReadOrderlyShutdown() before
the socket was actually closed.
The fix is to read the OKAY and then call ReadOrderlyShutdown() which
will then wait for the socket to be closed.
Test: Made the server hang in adb_server_cleanup() during kill-server
and kill-server would hang (as desired).
Test: To test resilience, tried preventing the server from sending OKAY and
adb kill-server still worked properly.
Change-Id: I4f0f11b86bbdc983670273ef5d3bb1dff7ab3697
Signed-off-by: Spencer Low <CompareAndSwap@gmail.com>
On Windows, when running adb server nodaemon and pressing Ctrl-C,
adb_server_cleanup (an atexit handler) would call kick_all_transports()
which would eventually fail a CHECK because the current thread was not
equal to the main thread. This is because Ctrl-C is implemented in
Windows by the OS creating a new thread in the process and calling the
Ctrl-C handler from there.
The CHECK fail would print out the CHECK expression and call abort()
which would record a crash in the Windows Event Log, plus would
potentially upload a crashdump to Microsoft's Watson service.
This might be a regression from d51c6df1ef.
The fix is to share more code between platforms, removing the call to
Win32 SetConsoleCtrlHandler() and just use the C Runtime's signal()
implementation which is built upon SetConsoleCtrlHandler(). The signal
handler still ends up being called from another thread, but the handler
is thread-safe enough so this seems to work.
Test: On Win10 and Vista, run adb server nodaemon and then try Ctrl-C,
Ctrl-Break and close console window.
Change-Id: I6603970616098d2b3ce68f2a3d4e5515ec859811
Signed-off-by: Spencer Low <CompareAndSwap@gmail.com>
We were accidentally returning 0 instead of the number of bytes written
whenever we wrote a USB packet that had a size that was a multiple of
the USB packet size, which resulted in the device getting kicked.
Bug: http://b/113070258
Test: python test_device.py
Change-Id: Ib3d6415545e90e1f4730afc8ad8713d10bb1534a
It was only needed when we statically linked libfec into libadbd in
past.
Test: `mmma -j system/core/adb`
Test: `m -j installclean && m -j bootimage` with aosp_taimen-userdebug.
Check the installed files in recovery image.
Change-Id: I8627d5f98568ab1d71e6a47cb1b2540a33bffdab
Make `adb disconnect` remove transports immediately, instead of on
their next reconnection cycle.
Test: adb connect unreachable:12345; adb devices; adb disconnect; adb devices
Change-Id: I35c8b57344e847575596d09216fc636be47dde64
Unit test for adb on Windows writing Unicode to an actual console
Window, as opposed to a pipe or file.
Test: Ran test on Ubuntu and Windows 10, tested version of adb with
incorrect Unicode handling and verified that test failed
Change-Id: Ibdda46d0fee83004537bcbb48a5c2fd6d3e1d593
Signed-off-by: Spencer Low <CompareAndSwap@gmail.com>
We can't remove from the middle of a priority_queue, which a followup
commit wants to do, so switch to std::set, with the side benefit of
making operator< point the right direction.
Test: mma
Test: ./test_adb.py
Change-Id: I784c1dcc91f0a9cf760e9fa1710202e37e85432b
Provide a way to selectively disable USB, automatic emulator
connection, and mDNS, to make reading through ADB_TRACE logging easier.
Test: manual
Change-Id: Ic6a06cdce14235415520cbf2d51c7f7031b7a7b3
* changes:
adb: report connection status when we're unauthorized.
adb: disable test_device.FileOperationsTest.test_pull_symlink_dir.
adb: fix test_device.FileOperationsTest.test_push_empty
adb: switch test_adb.py over to double quotes.
adb: make test_adb.py work on windows.
adb: switch test_adb.py to python3.
* changes:
init: add fs_mgr_overlayfs_mount_all to FirstStageMount
adb: add overlayfs handling for readonly system filesystems
fs_mgr: get fs_mgr_mount_all to call fs_mgr_overlayfs_mount_all
fs_mgr: add overlayfs handling for squashfs system filesystems
Previously, connecting to devices that end up as unauthorized would
wait 10 seconds before reporting failure to the user. After this
change, notification happens as soon as the adb server realizes.
Test: manual
Change-Id: If7c8d38f22da3d98b952eee6a334abc8566bb751
Switch from os.pipe to socket.socketpair for the fake adbd termination
termination signaller, that we can select on it on windows.
Test: test_adb.py on windows (2 failures on windows)
Change-Id: I37df06e465ec8be28cfb18a5c21ef30125195004
Currently, test_adb.py doesn't work on Windows, because we're selecting
on a pipe, which doesn't work on Windows. Python 3.5 adds socketpair
support to Windows, so switch over to Python 3 to make it so we can use
that.
Test: python3 test_adb.py
Change-Id: I0fbd1bca0b28324658831d5ef8ee08aefe2b0596
adb verity-on setup overlayfs directories, do not skip if verity
feature not configured for device.
adb verity-off teardown overlayfs directories, do not skip if verity
feature not configured for device.
adb remount setup overlayfs directories and mount if possible, and
do so without a reboot if possible.
Test: compile
Bug: 109821005
Bug: 110985612
Change-Id: I28c4c23fea44b886c5523f0286a523f0b0485df0
In order to run them continuously, add them to general-test
zip.
Test: make general-tests
Bug: 112104122
Change-Id: I7a1143ac638626069ed78ddd450063e9489e22e8
Previously, we were returning the result of SendOkay/SendFail in a few
places after handling a host request, which is incorrect for two
reasons. First, the return type of SendOkay/SendFail is bool, and
handle_host_request was expected to return 0 on success. Second, we
don't care if the SendOkay fails; if we got to that point, we're done
with the request, regardless of whether we succeeded to report our
result. The result of this was a spurious failure result reported after
the initial result, which was ignored by the adb client.
Test: manually straced adb server
Test: python test_adb.py
Test: python test_device.py
Change-Id: I7d45ba527e1faccbbae5b15e7a0d1557b0a84858
* changes:
adb: actually enable fdsan.
adb: move AdbCloser to its rightful place.
libdebuggerd: extract and print the fdsan table.
crash_dump: pass the address of the fdsan table.
adb was using a custom unique_fd closer that didn't have an
implementation for fdsan, which meant that none of our FDs were
actually tracked. Guard this behind ifdefs so that we only use this
on Windows, and delete our implementation of Pipe in favor of the one
in libbase while we're at it. libbase's implementation always sets
O_CLOEXEC, so fix up the instance of Pipe that doesn't expect that.
Test: mma
Test: adb start-server
Test: debuggerd `pidof adbd`
Change-Id: Ic29d641a2f93fb42384b00c51775048c8bcbe152
This CL builds the former `libadbd` as a shared library, and moves
`adbd` to using shared libraries.
We can't switch `libadbd` from static to shared library directly, due to
the circular dependency between `libadbd` and `adbd`. In particular,
daemon_service_to_fd() can't be compiled into `libadbd`, as it needs to
be overridden by recovery/minadbd.
This CL creates a static library `libadbd_core` as the common base,
which contains everything from the former `libadbd`. Both of the two
shared library targets `libadbd` and `libadbd_services` depend on
`libadbd_core`.
The `adbd` on device (under both of normal boot and recovery) now
depends on `libadbd.so` and `libadbd_services.so`. recovery/minadbd will
depend on `libadbd.so` and `libminadbd_services.so` in future (after
fully converting recovery to Soong).
Bug: 78793464
Test: `m dist`
Test: Run adbd_test on marlin.
Test: Build and flash marlin on device. Check basic adbd functionalities
(`adb shell` and `adb sync`) under normal boot and recovery.
Test: `adb sideload` on marlin.
Change-Id: Iacbd4db524ef94abd175cd1d27688f4faf3db024
Allow .dm files (DexMetadata) to be passed to adb install-multiple.
Do not rename the input files based on their indices as the naming matters
for associating an .dm file to an .apk file.
Test: adb install-multiple -p com.android.cts.classloadersplitapp base.apk
split.apk split.dm
Bug: 30934496
Change-Id: I2ac39e00d64eae938124250033f79e02f3c3f9c0
(cherry picked from commit aa7753871e)
Rebooting to these targets requires writing bootloader
messages and thus root. Moving them into init means that
adb, reboot don't need root to use these targets.
Test: try rebooting to these targets
Bug: 78793464
Change-Id: Ia002d1e3b1cb0c0616f60435fb9af4dce162cf84
This code was unreachable, since all of the callers were calling
register_socket_transport with foo.c_str() as the serial. Lift this
assumption into the type system by switching from char* to std::string
for the argument type.
Bug: http://b/112147760
Bug: https://www.viva64.com/en/b/0579/
Test: mma
Change-Id: I5a6ee265feee6b83bc933a64d895eed39fce68e7
An accidental side-effect of the change to unique_fd was that we
started closing the reboot service socket before pausing and waiting
for our death. This results in the client immediately returning, which
means they might get a chance to run other commands before we actually
manage to reboot.
Bug: http://b/112104037
Test: adb reboot; adb devices
Change-Id: Id61321da0c08ebd1ab57f1ce926bafd9109dd9c2
Previously, when a TCP connection was disconnected from adbd, we were
registering it with ReconnectHandler, which led to the transport
sticking around after the socket was closed. Due to the naming of
TCP transports in adbd (host-<fd number>), this results in incoming
connections being immediately closed if their file descriptor number
ends up being the same as a TCP transport that had previously
disconnected.
Guard all of the reconnect logic with ADB_HOST, to fix this.
Bug: http://b/112054041
Test: while true; do adb connect <device>; adb connect <device>; adb shell true; done
Change-Id: Ib55d304d7e07d6d744e8321d34671bb6d4b91afe
Most disconnects we're likely to encounter are cases where either we
notice immediately and can start reconnecting almost immediately (adbd
restarting because of `adb root`, etc.), or where we won't notice for a
while anyway, so a 10 second sleep is somewhat meaningless.
Test: adb root; time adb wait-for-device shell
Change-Id: I18e9213dc4e84d735e9240118a368dcb38f21c78
libstdc++ implements wait_until by calculating the offset between its
default clock and the clock that it's given by calling now() on each
and subtracting, and then adds that offset to the time_point argument.
When time_point::max is used, this overflows, resulting in the
reconnection thread spinning.
Test: wine adb.exe server nodaemon
Change-Id: Ife58f0aad14bc44c0804483d3ff2351c28b3d576
The daemon-side reverse functions depended on handle_forward_request:
move them back instead of duplicating the logic we had in
handle_host_request. Accomplish what we originally wanted to do in this
change by changing the transport argument of handle_forward_request to a
std::function that acquires a transport, either via
acquire_one_transport or immediately returning a value that we already
have.
As a side effect, fix a bug where we would emit spurious errors for host
service requests.
Bug: http://b/112009742
Test: echo "001chost:connect:127.0.0.1:5555" | nc localhost 5037
Test: python test_device.py
Test: python test_adb.py
Change-Id: Iccc555575df6dbd7de10382854c4ea2c6f4beeaa
commandline.cpp includes commandline.h which defines
StandardStreamsCallbackInterface which calls fwrite(). In the
compilation unit for commandline.cpp, fwrite is getting remapped to
adb_fwrite (good), but the compilation unit for bugreport.cpp includes
sysdeps.h pretty late, which prevents fwrite from getting remapped to
adb_fwrite.
Apparently when linking, the version of StandardStreamsCallbackInterface
that gets used is the one from bugreport.cpp's compilation unit, which
doesn't call adb_fwrite().
And it's necessary to call adb_fwrite() to get Unicode console output on
Windows.
The fix is to #include "sysdeps.h" earlier in bugreport.cpp. I searched
the other object files for other unremapped calls to printf/fwrite/etc.
and didn't find any.
Bug: https://issuetracker.google.com/issues/111972753
Test: mma, manual test on Windows 10 x64
Change-Id: I322dff75a878397f5e10227e746e77b0024129d0
Signed-off-by: Spencer Low <CompareAndSwap@gmail.com>
The fs_has_shared_blocks function had two problems. One, it called
statfs() on the mount point, which will return information about the
file system the mount point is on, rather than the filesystem mounted at
that location. Second, the check for EXT4_SUPER_MAGIC was inverted.
Bug: N/A
Test: adb remount -R works on an ext4 deduplicated device
Change-Id: I2e5ef895ea274cb7cc3c35295120da90a026d0d2
The check was accidentally flipped when refactoring from strcmp to
std::string::operator==, inverting the behavior of `remount -R`.
Test: `adb remount` with verity enabled
Change-Id: Ib43889f1f4cc2f8fe1fd5d6e17e47d538dbe91bd
Let minadbd override daemon services by pulling out the daemon services
into a separate translation unit, that isn't compiled into libadbd.
Bug: http://b/111831478
Test: mma
Change-Id: Iecfebea371e03864108eca9a4d2e9cfd5db34749
Multiple codepaths were closing the fd they passed into
register_socket_transport on failure, which would close the fd itself.
Switch things over to unique_fd to make it clear that we don't actually
have to close on failure.
Test: mma
Change-Id: I2d9bdcb1142c24931d970f99ebdf9a8051daf05c
register_socket_transport takes ownership of the fd, leading to a
double close if the registration fails.
Test: mma
Change-Id: I9d699af1a979bedc1dc466427436d47f09d0a88f
Replace all usages of android::base::unique_fd with the unique_fd from
adb_unique_fd.h, which calls adb_close instead of close on Windows.
Most of these changes are no-ops, except for the ones to
create_service_thread, which was probably pretty broken on Windows.
Test: python test_device.py
Test: adb_test
Test: wine adb_test.exe
Change-Id: Ia4d03f9e2e7ddc88c97dc64172d721f93f3bf853
Also, fix error reporting when forward fails because we can't get a
transport, because there's either zero, or more than one transport that
matches the request.
Bug: http://b/111021517
Bug: http://b/111374366
Change-Id: Ia4c3bf6215c3ff4e9023ba1af556f5b10463bd6d
Test: manual
This change makes `adb remount` work again in some devices.
Bug: None
Test: `adb remount` in taimen
Change-Id: I04ec043fdb868f18a53a012c82e239c862ae7eff
This change gets rid of most malloc/calloc/free calls. The future is
now!
Bug: None
Test: test_device.py
Change-Id: Iccfe3bd4fe45a0319bd9f23b8cbff4c7070c9f4d
This change removes the void* argument passing and instead uses C++11
features to avoid having to handle memory manually.
Bug: None
Test: python ./system/core/adb/test_device.py
Change-Id: I6380245b2ca583591810e3e363c67c993a107621
This change preserves any additional flags mount flags (e.g. MS_NODEV)
that any of the mounts would have. This avoids unnecessarily opening up
permissions, and also allows kernels that have additional restrictions
about what mount flags can be used to be happy with the remounts.
Bug: 111618714
Test: `adb remount` works in Chrome OS
Test: `adb remount` works in sailfish_aosp
Change-Id: I20d9f2feaf3a47b93bfcdfb4164ee61546ec0b68
Fastboot protocol doesn't include zero packets,
so make it possible to configure that.
Allow fastbootd to see how many bytes the handle
can read/write at once.
Test: adb works
Bug: 78793464
Change-Id: I31e444f384d9d0cdf1ea936439b2028f8151c3b8
Previously, read and write would return 0
on success. Now it will return the number
of bytes read/write. This is more consistent
with other usb handles and is needed in order
to handle partial packets (for fastbootd).
Update usb_write in other usb handles
to return amount written.
Change transport_usb accordingly.
Test: adb works
Bug: 78793464
Change-Id: If07ff05fbc8120343f20661475d34f4e5ff805de
Fastbootd will reuses adb's functionfs transport
implementation.
Move it to daemon/include as well so it can be accessed
with "adbd/usb.h". Otherwise usb.h will conflict with
other imports.
Test: adb builds and works
Bug: 78793464
Change-Id: If3ba190d5c74b5f3633411f0484195e5a2a34d44
Builtin command "type" in zsh doesn't support -t option and this
is resolved by checking the shell type prior to sourcing them.
Instead of using "type -t" explicitly, check_type() knows the the
type of the current shell and behaves accordingly.
Bug: 110629292
Test: (zsh) source build/envsetup.sh && lunch aosp_arm
(bash) source build/envsetup.sh && lunch aosp_arm
Change-Id: Ie39e130e9cc87135cfd522abedba11ad5ac25261
escape_arg reuses the same index for the source (s) and the destination
(result), so it breaks on strings containing more than one quote, e.g:
* a'b'c ==> 'a'\''b'c'
* a'bcde'f ==> 'a'\''b'\'cde'f'
Also make the function more efficient by doing fewer string copies. This
code is based on the android::base::Split code.
Use EXPECT_EQ because the tests can keep going if one fails.
Bug: none
Test: adb_test --gtest_filter=adb_utils.escape_arg
Change-Id: I6ca6e905fa53cc61b9a87276cb7116a5df7e8017
We shipped (well, are about to ship) an adbd that spuriously fails to
create directories upon push. Work around this in the adb client by
running a mkdir on all of the directories we would have otherwise
created.
On devices where we perform the workaround, this coincidentally fixes
a historic bug where we failed to push empty directories.
Bug: http://b/25566053
Bug: http://b/110953234
Test: python test_device.py
Change-Id: I690ec356c206fed4e5ab2c681c5570c8b231e26b
When pushing to a path, we first try to ensure the directory path
exists and has the permissions expected by fs_config. Due to a change
that changed the fs_config check from a blacklist to a whitelist, we
started doing this for /data (which doesn't begin with /data/), and the
UID/GID for that path was accidentally being reused for following path
segments that didn't exist, leading to a failed attempt to chown
/data/local/tmp/foo to be owned by system.
Bug: http://b/110953234
Test: python test_device.py
Change-Id: Ie798eec48bcf54aea40f6d90cc03bb2170280ee8
* changes:
Do not customize __format__ for Windows/MinGW to gnu_printf
Adapt to switch to Clang for Windows host builds
Update cflags for building Windows modules with Clang
Bug: http://b/69933090
Bug: http://b/69933068
MinGW uses gnu_printf to force C99 printf analysis with GCC, but clang
does not support gnu_printf. So just use the default that's used for
other platforms. This also mirrors upstream commit
015e637b4b/.
Test: m native-host-cross with Clang.
Change-Id: I3deb266d70e25296c4ae1d58637afbabc3d949c1
Bug: http://b/69933068
- Add -Wexit-time-destructor globally after fixing one warning
- Enable -Wthread-safety only for non-windows targets. The version of
libstdc++ we use for Windows doesn't have the correct thread-safety
annotations.
Test: Run Clang-built adb_test.exe under wine
Change-Id: I76a43060342e7d1dc370ce3e117f3563c82b7751
* changes:
adb: detect some spin loops and abort.
adb: add an id field to fdevent.
adb: delete unused members in fdevent.
adb: add `adb raw` to connect to an arbitrary service.
Track pending fdevents, and abort if we see an fdevent ready for
read/write for 5 minutes continuously.
Also, add a service that intentionally starts spinning, to test this.
Test: manually changed timeout to a minute, `adb raw spin`
Change-Id: Ibfa5e7e654996587f745887cb04987b982d79bed
Tracking fdevents by pointer is dangerous because an fdevent can be
destroyed and recreated at the same address. Add a monotonically
increasing id field to fdevent for this purpose.
Test: treehugger
Change-Id: I706b57a9e669290ef2db258f85489a5155fc1152
Add a command to connect to an arbitrary service, for debugging
purposes.
Test: `adb raw shell:ls`
Change-Id: I69d4d585e5ecfa7cb8c7a543a2a27df7033b26c7