[Bug 39531] Carliv Image Kitchen for Android 1.0 batch file fails to run external 'chmod' program

wine-bugs at winehq.org wine-bugs at winehq.org
Fri Oct 30 16:13:12 CDT 2015


https://bugs.winehq.org/show_bug.cgi?id=39531

Anastasius Focht <focht at gmx.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |download
             Status|UNCONFIRMED                 |NEW
                URL|                            |http://dl-1.va.us.xda-devel
                   |                            |opers.com/3/2/5/3/3/0/6/Car
                   |                            |livImageKitchen-Windows_v1.
                   |                            |0.zip
                 CC|                            |focht at gmx.net
          Component|-unknown                    |cmd
            Summary|bat file bugs               |Carliv Image Kitchen for
                   |                            |Android 1.0 batch file
                   |                            |fails to run external
                   |                            |'chmod' program
     Ever confirmed|0                           |1

--- Comment #3 from Anastasius Focht <focht at gmx.net> ---
Hello folks,

from the attached backtrace it might be this: 'Carliv Image Kitchen for
Android' (unpack/repack boot-recovery tool)

http://forum.xda-developers.com/android/development/tool-cika-carliv-image-kitchen-android-t3013658

This information should have been provided in first place.
We don't have a magic glass ball.

There is a top-level batch file 'carliv.bat'.
I assume you executed that one (again: guess).
Relevant part of batch file:

--- snip ---
...
@echo off
cd "%~dp0"
IF EXIST "%~dp0\bin" SET PATH=%PATH%;"%~dp0\bin"
chmod -R 755 bin
...
--- snip ---

'chmod' seems to be part of a packaged Cygwin:

--- snip ---
$ ls -1sh bin/
total 5.8M
  28K bzip2.exe
  24K chmod.exe
 140K cpio.exe
  40K ctext.exe
  64K cygbz2-1.dll
 108K cyggcc_s-1.dll
1012K cygiconv-2.dll
  44K cygintl-8.dll
 144K cyglzma-5.dll
 128K cyglzo2-2.dll
 3.2M cygwin1.dll
 104K gzip.exe
  40K imageinfo.exe
  32K logo.png
 176K lz4.exe
  56K lzop.exe
 156K minigzip.exe
  80K mkbootfs.exe
  44K mkbootimg.exe
  44K mtkbootimg.exe
  40K unpackbootimg.exe
  44K unpackmtkimg.exe
  68K xz.exe
--- snip ---

Relevant part of trace log:

--- snip ---
$ WINEDEBUG=+tid,+seh,+relay,+cmd wine cmd.exe /c carliv.bat >>log.txt 2>&1
...
0031:trace:cmd:WCMD_process_commands Executing command: 'L"IF EXIST
\"Z:\\home\\focht\\Downloads\\CarlivImageKitchen\\\\bin\" SET
PATH=C:\\windows\\system32;C:\\windows;C:\\windows\\system32\\wbem;\"Z:\\home\\focht\\Downloads\\CarlivImageKitchen\\\\bin\""' 
...
0031:trace:cmd:WCMD_part_execute cmdList(0x332640), firstCmd(L"SET
PATH=C:\\windows\\system32;C:\\windows;C:\\windows\\system32\\wbem;\"Z:\\home\\focht\\Downloads\\CarlivImageKitchen\\\\bin\""),
doIt(1) 
...
0031:trace:cmd:WCMD_execute param1: L"PATH", param2:
L"C:\\windows\\system32;C:\\windows;C:\\windows\\system32\\wbem;\"Z:\\home\\focht\\Downloads\\CarlivImageKitchen\\\\bin\""
...
0031:trace:cmd:WCMD_setshow_env set: Setting var 'L"PATH"' to
'L"C:\\windows\\system32;C:\\windows;C:\\windows\\system32\\wbem;\"Z:\\home\\focht\\Downloads\\CarlivImageKitchen\\\\bin\""'
0031:Call KERNEL32.SetEnvironmentVariableW(00157b50 L"PATH",00157b5a
L"C:\\windows\\system32;C:\\windows;C:\\windows\\system32\\wbem;\"Z:\\home\\focht\\Downloads\\CarlivImageKitchen\\\\bin\"")
ret=7eca2c3f
0031:Ret  KERNEL32.SetEnvironmentVariableW() retval=00000001 ret=7eca2c3f
...
0031:trace:cmd:WCMD_DumpCommands Parsed line:
0031:trace:cmd:WCMD_DumpCommands 0x14f6a0 0 00 (nil) L"chmod -R 755 bin"
Redir:L""
0031:trace:cmd:WCMD_process_commands Executing command: 'L"chmod -R 755 bin"' 
...
0031:trace:cmd:WCMD_execute command on entry:L"chmod -R 755 bin" (0x332640)
...
0031:trace:cmd:WCMD_execute Command: 'L"chmod -R 755 bin"' 
...
0031:trace:cmd:WCMD_execute param1: L"-R", param2: L"755"
0031:trace:cmd:WCMD_run_program Running 'L"chmod -R 755 bin"' (0)
0031:Call KERNEL32.GetEnvironmentVariableW(7ecb0b14 L"PATH",0032e074,00001ffe)
ret=7eca95ab
0031:Ret  KERNEL32.GetEnvironmentVariableW() retval=00000069 ret=7eca95ab
0031:Call KERNEL32.GetEnvironmentVariableW(7ecaffae
L"PATHEXT",00329e68,00002000) ret=7eca96e5
0031:Ret  KERNEL32.GetEnvironmentVariableW() retval=00000030 ret=7eca96e5
0031:trace:cmd:WCMD_run_program Searching in
'L".;C:\\windows\\system32;C:\\windows;C:\\windows\\system32\\wbem;\"Z:\\home\\focht\\Downloads\\CarlivImageKitchen\\\\bin\""'
for 'L"chmod"'
0031:Call KERNEL32.GetFullPathNameW(00332070 L".",00000104,00329998,00000000)
ret=7eca986b
0031:Ret  KERNEL32.GetFullPathNameW() retval=0000002a ret=7eca986b
0031:Call KERNEL32.FindFirstFileW(00329998
L"Z:\\home\\focht\\Downloads\\CarlivImageKitchen\\chmod.*",00329ba0)
ret=7eca9912
0031:Ret  KERNEL32.FindFirstFileW() retval=ffffffff ret=7eca9912
0031:Call KERNEL32.FindClose(ffffffff) ret=7eca9923
0031:Ret  KERNEL32.FindClose() retval=00000000 ret=7eca9923
0031:Call KERNEL32.GetFullPathNameW(00332070
L"C:\\windows\\system32",00000104,00329998,00000000) ret=7eca986b
0031:Ret  KERNEL32.GetFullPathNameW() retval=00000013 ret=7eca986b
0031:Call KERNEL32.FindFirstFileW(00329998
L"C:\\windows\\system32\\chmod.*",00329ba0) ret=7eca9912
0031:Ret  KERNEL32.FindFirstFileW() retval=ffffffff ret=7eca9912
0031:Call KERNEL32.FindClose(ffffffff) ret=7eca9923
0031:Ret  KERNEL32.FindClose() retval=00000000 ret=7eca9923
0031:Call KERNEL32.GetFullPathNameW(00332070
L"C:\\windows",00000104,00329998,00000000) ret=7eca986b
0031:Ret  KERNEL32.GetFullPathNameW() retval=0000000a ret=7eca986b
0031:Call KERNEL32.FindFirstFileW(00329998 L"C:\\windows\\chmod.*",00329ba0)
ret=7eca9912
0031:Ret  KERNEL32.FindFirstFileW() retval=ffffffff ret=7eca9912
0031:Call KERNEL32.FindClose(ffffffff) ret=7eca9923
0031:Ret  KERNEL32.FindClose() retval=00000000 ret=7eca9923
0031:Call KERNEL32.GetFullPathNameW(00332070
L"C:\\windows\\system32\\wbem",00000104,00329998,00000000) ret=7eca986b
0031:Ret  KERNEL32.GetFullPathNameW() retval=00000018 ret=7eca986b
0031:Call KERNEL32.FindFirstFileW(00329998
L"C:\\windows\\system32\\wbem\\chmod.*",00329ba0) ret=7eca9912
0031:Ret  KERNEL32.FindFirstFileW() retval=ffffffff ret=7eca9912
0031:Call KERNEL32.FindClose(ffffffff) ret=7eca9923
0031:Ret  KERNEL32.FindClose() retval=00000000 ret=7eca9923
0031:Call KERNEL32.GetFullPathNameW(00332070
L"\"Z:\\home\\focht\\Downloads\\CarlivImageKitchen\\\\bin\"",00000104,00329998,00000000)
ret=7eca986b
0031:Ret  KERNEL32.GetFullPathNameW() retval=0000005b ret=7eca986b
0031:Call KERNEL32.FindFirstFileW(00329998
L"Z:\\home\\focht\\Downloads\\CarlivImageKitchen\\\"Z:\\home\\focht\\Downloads\\CarlivImageKitchen\\bin\"\\chmod.*",00329ba0)
ret=7eca9912
0031:Ret  KERNEL32.FindFirstFileW() retval=ffffffff ret=7eca9912
0031:Call KERNEL32.FindClose(ffffffff) ret=7eca9923
0031:Ret  KERNEL32.FindClose() retval=00000000 ret=7eca9923
...
0031:Call user32.LoadStringW(7ec90000,00000410,7ed69d40,00000800) ret=7ecaad24
0031:Ret  user32.LoadStringW() retval=0000004a ret=7ecaad24
0031:Call
KERNEL32.FormatMessageW(00000500,7ed69d40,00000000,00000000,003298e0,00000000,003298e4)
ret=7eca758f
0031:Ret  KERNEL32.FormatMessageW() retval=00000059 ret=7eca758f
...
0031:Call KERNEL32.WideCharToMultiByte(000001b5,00000000,00157c30 L"Can't
recognize 'chmod -R 755 bin' as an internal or external command, or batch
script.\r\n",00000059,0013f698,0000ffff,7ecaffe8,0032989c) ret=7eca7397 
...
--- snip ---

Paths need to have escaped double quotes removed when doing search.

Source:
https://source.winehq.org/git/wine.git/blob/23e7b5a6b0fcb787d4b322f508054a8fdbcc9cd0:/programs/cmd/wcmdmain.c#l1038

--- snip ---
1038 void WCMD_run_program (WCHAR *command, BOOL called)
1039 {
1040   WCHAR  temp[MAX_PATH];
1041   WCHAR  pathtosearch[MAXSTRING];
1042   WCHAR *pathposn;
1043   WCHAR  stemofsearch[MAX_PATH];    /* maximum allowed executable name is
1044                                        MAX_PATH, including null character
*/
1045   WCHAR *lastSlash;
1046   WCHAR  pathext[MAXSTRING];
1047   WCHAR *firstParam;
1048   BOOL  extensionsupplied = FALSE;
1049   BOOL  status;
1050   DWORD len;
1051   static const WCHAR envPath[] = {'P','A','T','H','\0'};
1052   static const WCHAR delims[] = {'/','\\',':','\0'};
1053 
1054   /* Quick way to get the filename is to extract the first argument. */
1055   WINE_TRACE("Running '%s' (%d)\n", wine_dbgstr_w(command), called);
...
1096   /* Loop through the search path, dir by dir */
1097   pathposn = pathtosearch;
1098   WINE_TRACE("Searching in '%s' for '%s'\n", wine_dbgstr_w(pathtosearch),
1099              wine_dbgstr_w(stemofsearch));
1100   while (pathposn) {
1101     WCHAR  thisDir[MAX_PATH] = {'\0'};
1102     WCHAR *pos               = NULL;
1103     BOOL  found             = FALSE;
1104 
1105     /* Work on the first directory on the search path */
1106     pos = strchrW(pathposn, ';');
1107     if (pos) {
1108       memcpy(thisDir, pathposn, (pos-pathposn) * sizeof(WCHAR));
1109       thisDir[(pos-pathposn)] = 0x00;
1110       pathposn = pos+1;
1111 
1112     } else {
1113       strcpyW(thisDir, pathposn);
1114       pathposn = NULL;
1115     }
1116 
1117     /* Since you can have eg. ..\.. on the path, need to expand
1118        to full information                                      */
1119     strcpyW(temp, thisDir);
1120     GetFullPathNameW(temp, MAX_PATH, thisDir, NULL);
...
--- snip ---

$ sha1sum CarlivImageKitchen-Windows_v1.0.zip 
fc89c0467d9c6a10641c245e2abb4e82e0eca650  CarlivImageKitchen-Windows_v1.0.zip

$ du -sh CarlivImageKitchen-Windows_v1.0.zip 
2.4M    CarlivImageKitchen-Windows_v1.0.zip

$ wine --version
wine-1.7.54

Regards

-- 
Do not reply to this email, post in Bugzilla using the
above URL to reply.
You are receiving this mail because:
You are watching all bug changes.



More information about the wine-bugs mailing list