i am calling PMD Tool from Clearcase triggers, i want to process based on the reponse from PMD validation. but PMD tool doesnt return any flag or nything back to CC trigger. please help me how can i handle this.
Generally, it is best to redirect the result (stdout and stderr) of an external tool to a file.
Then the hook (which just called PMD) can read that result file and return its content.
Related
So when trying to use the stdin/stdout/stderr streams in a Windows GUI app, one typically has to call AllocConsole (or AttachConsole) in order to initialize those streams for use. There are lots of posts on here on what you need to do AFTER calling AllocConsole (i.e. use freopen_s on the respective streams, etc).
I have a program where I want to redirect stdout and stderr to an anonymous pipe. I have a working example where I call:
AllocConsole();
FILE* fout;
FILE* ferr;
freopen_s(&fout, "CONOUT$", "r+", stdout);
freopen_s(&ferr, "CONOUT$", "r+", stderr);
HANDLE hreadout;
HANDLE hwriteout;
HANDLE hreaderr;
HANDLE hwriteerr;
SECURITY_ATTRIBUTES sao = { sizeof(sao),NULL,TRUE };
SECURITY_ATTRIBUTES sae = { sizeof(sae),NULL,TRUE };
CreatePipe(&hreadout, &hwriteout, &sao, 0);
CreatePipe(&hreaderr, &hwriteerr, &sae, 0);
SetStdHandle(STD_OUTPUT_HANDLE, hwriteout);
SetStdHandle(STD_ERROR_HANDLE, hwriteerr);
This snippet successfully sets stdout and stderr to the write ends of the anonymous pipes and I can capture the data.
However calling AllocConsole will spawn a Conhost.exe - this is the actual black window that pops to the screen. I don't have a use for this and most importantly, I would like to avoid the process creation of a child conhost.exe under my program.
So the question is, how can I fool Windows into thinking it has a console attached/manually setup the initial stdout and stderr file streams so that I can then redirect them as I have done already? I have looked at the AllocConsole call in a debugger as well as GetStdHandle and SetStdHandle to try and get a sense of what is going on, but my RE skills are lacking.
Without AllocConsole, the freopen_s calls fail with error 6, Invalid Handle. GetStdHandle also returns a NULL handle. Calling SetStdHandle succeeds (based on it's return code and calling GetLastError), however this doesn't appear to actually get things set up where I need them as I don't receive any output in my pipe.
Any ideas?
Use the SetStdHandle function to assign your pipe HANDLE values to STD_INPUT_HANDLE and STD_OUTPUT_HANDLE.
I'm trying to use dbus/tools/GetAllMatchRules.py to get diagnostic information. When I run it without parameters as my regular user I get "GetConnectionMatchRules failed: did you enable the Stats interface?"
I modified GetAllMatchRules to print the specific exception details. It now says
GetConnectionMatchRules failed: did you enable the Stats interface?: org.freedesktop.DBus.Error.AccessDenied: The caller does not have the necessary privileged to call this method
So then I'm wondering, does it work at all? So I sudo su and run it again and it gives me the kind of information I'd expect to see, just not for the right bus. Oddly, if I use the --system parameter, even root gets org.freedesktop.DBus.Error.AccessDenied .
The repository claims, in bus/example-session-disable-stats.conf.in , that
"If the Stats interface was enabled at compile-time, users can use it on
the session bus by default. Systems providing isolation of processes
with LSMs might want to restrict this. This can be achieved by copying
this file in #EXPANDED_SYSCONFDIR#/dbus-1/session.d/
"
But that's clearly not the case because my user can NOT access this information.
I even tried a brute force approach to disabling (commenting out) ALL deny statements at /usr/share/dbus-1/system.conf and reloading and it still doesn't work. I also tried a full system restart in case I wasn't reloading correctly. I also did a system-wide search for system.conf in case it's actually using some other conf file that I'm not seeing, which would mean I'm modifying the wrong thing. I got a big hint that that's not the case when I had a typo (-- instead of --> for commenting out) and it failed to reload, but did reload once I fixed the typo.
I'm ok with the possibility that I can only do this signed in as root, so I also tried modifying GetAllMatchRules to use dbus.bus.BusConnection(), and force-feeding it the session address (unix:path=/run/user/1000/bus) which results in
"org.freedesktop.DBus.Error.NoReply: Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken."
Incidentally, this is the same issue that happens if I leave the code alone but use sudo -E su instead of just sudo su (the -E option in this case means that the $DBUS_SESSION_BUS_ADDRESS variable is retained)
I'm not sure what to try next...
Turns out there isn't currently a solution, the privilege error is simply the code that was chosen to indicate that the method is an unimplemented stub method
I try to disable all logs on my program,
I did disable esp logs
but when I use printf in my channel and open make monitor
printf still works.
how and why?
I want to disable it.
The system logs and printf are two different things over here. In your project sdkconfig file check if the parameter 'CONFIG_CONSOLE_UART_DEFAULT' is set.
This defines where all your console outputs are dumped into.
In your case you want to disable all the printf logs, you can try setting 'CONFIG_CONSOLE_UART_NONE=y'.
If you are doing it thourgh make menuconfig of esp-idf, it will come under - component config > ESP32-Specific > UART for console output (Default: UART0, TX=GPIO1, RX=GPIO3) > None
Hope I answered to your question. :)
I have used TCP_MD5SIG to create password/key for the connection using the API - setsockopt() in C, Linux. This works fine for me. However, when I use it to remove the password/disable authorization with the same API except that the
struct_tcp_md5sig.tcm_Key = 0;
struc tcp_md5sig.tcm_keylen = 0;
I see that when I invoke the same API -
rc = setsockopt(sock_fd, IPPROTO_TCP, TCP_MD5SIG, &md5sig, sizeof(md5sig));
I see that the rc is -1. The strerror says that "no such file or directory".
I am confused on what I should do to disable the authorization. The same API works, when I pass the password. On the other hand, the same API doesn't work when I want to disable the authorization. I have enabled this protocol in the kernel. So, there is no issue with enabling of this feature in kernel.
AFAICT, You need to ensure that tcp_md5sig.tcpm_addr is the same as when you registered to have it removed.
I am trying to set the file attributes as follows:
create file foo.txt with 0644 permissions
when I am trying to setxattr for this as
if (setxattr("foo.txt", "user.test", "test", 4, XATTR_CREATE) == -1)
perror("");
I am getting the error as Operation not supported
Is there any thing to enable?
How to resolve this?
From setxattr
RETURN VALUE
On success, zero is returned. On failure, -1 is returned and errno is set
appropriately.
...
If extended attributes are not supported by the file system, or are disabled,
errno is set to ENOTSUP.
So, either your file system doesn't support extended attributes (ext[234], cifs, btrfs do, for example) or they are disabled at the kernel build or at mount time.
For NFS there is no separate switch to enable extended attributes in the kernel config. From the source fs/nfs/dir.c, it seems to be enabled, when you enable support for CONFIG_NFS_V3 or CONFIG_NFS_V4. But NFS still depends on the underlying file system. So you must enable extended attributes on the server side as well.
From man mount
Mount options for ext2
...
user_xattr|nouser_xattr
Support "user." extended attributes (or not).