Monday, January 30, 2012

A build engineer's use-case of java decompiler

This is one scenario, which demonstrate the usage of java decompiler to a build engineer.

One morning, a developer walked to my cube and complained
    Developer: My changes are not picked in latest build
As a build engineer, it's a familiar complaint which I usually receive.
    Me: Cool !! provide me your change location in Perforce SCM tool and some time to debug.
That's the end of my short conversation. Now I started a massive search operation to find out, why the pretty girls changes are not picked :)

It's a Java based build system using Maven 2 and Jenkins.

Step 1: I made sure the code changes are picked up in last build by verifying the Change-list number available in perforce and the one Jenkins has picked during the build. Even I verified in the build machine, by checking the files it has synced. Everything is perfect, then I started wondering what's going wrong.

Step 2:  Since it is a maven build, I thought to check the content of jar package, our build has uploaded to nexus repository. I downloaded and extracted it and the got the mystery .class file. Now how can I prove that her changes are picked by the build using this .class file?

Step 3: I felt the need of a java decompiler. I downloaded "cavaj" java decompiler (it's free) and installed it. Opened the mystery .class file with java decompiler and I'm glad to find her changes.

Java decompiler is used to convert Java class files into Java source code. In fact, there is an arms race brewing between decompilers and so-called obfuscators, which profess to provide Java code some measure of protection from decompilers. In essence, obfuscators remove all non-essential symbolic information from your class files and, optionally, replace it with fake symbolic information designed to confuse the decompiler


Step 4: Now for curiosity I extended further to find out why the developer complaining it is not picked. The root cause of the issue is that,  developer was validating a jar file, which consumes her changes from another jar file. It's a maven dependency issue. Some how, the final jar file was not picking the right version of the dependent jar file, which is fixed later.

Wednesday, January 25, 2012

Jira Administration quick reference

1) Configuring the Layout and Design
Customising the Look and Feel
    Administration -> Global Settings -> Look and Feel -> To edit the logo, colours or time format, click the 'Edit Configuration' link at the bottom of the page
Changing the default language
  Administration -> General Configuration -> Edit Configuration > select the appropriate language in the drop-down box next to 'Default language'.
Configuring default issue navigator
  The Issue Navigator is used within JIRA to find and filter issues, and to display the search results in various formats ('views'). It is possible to
select which issue fields will be displayed as columns in the Issue Navigator.
   Administration -> Issue Fields -> Navigator Columns -> Add new column
Configuring the Default Dashboard
  Administration -> Global Settings -> System Dashboard -> Add Gadget
Configuring an Announcement Banner
  Administration -> Options & Settings -> Announcement Banner
Enabling Logout Confirmation
  Global Settings -> General Configuration -> Edit Configuration -> Logout confirmation

Tuesday, January 24, 2012

Productivity tools linkage

Reference: From slide prepared by Carl Sjoquist
I liked this image which depicts how various productivity tools in an organization collaborate. 

Monday, January 23, 2012

Generating ccs (Conary Change Set) file using rmake build Job-ID

To generate CCS (Conary Change Set) files, for the corresponding packages available on rBuilder server, follow these steps
  • rmake build <package name>.recipe

             This command will build the specified recipe file
             Ex: rmake build tomcat.recipe
          Note down the job number 
  • rmake changeset <jobid>  <package name>.ccs
          This command creates a changeset for the given <jobId>The created changeset contains all the binaries built for this job.
          Ex: rmake changeset 573 tomcat.ccs 
  • conary showcs --lsl <package name>.ccs
           Use conary showcs to examine changeset file contents 
            Ex: conary showcs --lsl tomcat.ccs 

Sunday, January 15, 2012

Cygwin error: Couldn't create pipe tracker for pid

Our builds started failing to connect to a Windows machine using sshd provided by cygwin.
Then when I tried to open cygwin shell, it started throwing the error


pinfo::wait: Couldn't create pipe tracker for pid 3534
Win32 error 231
bash: fork: Resource temporarily unavailable

After googling, the reason for this error, which I came to know is
  1. It's a limitation in the number of running processes under Windows. When cygwin cannot create a new process during a fork(), you will get this behavior.
    Some people have reported success turning off (or swapping) antivirus programs, or other tricks to reduce the number of running processes on their system.
  2. Well, what that message means is that for some reason, the child process
    failed to notify the parent of its existence within a reasonable amount of
    time after it was spawned.  That could mean that it died for some reason, or
    it could mean that it was alive, but failed to notify the parent process.
    
    
    
    
    Then I felt, it's good to reboot my Windows machine once and it has solved this problem for the time being. I will keep updated if it pop up again.
    
    
    Our cygwin version is
    $ cygcheck -V
    cygcheck version 1.90.4.1
    System Checker for Cygwin
    Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Red Hat, Inc.
    Compiled on Jun 12 2008
    
    
    
    and Windows version is "Windows XP professional 2002 SP2"
    I guess this issue doesn't occur with latest cygwin/Windows versions.

Wednesday, January 11, 2012

nexus "Item not found on path" error

We are using nexus 1.5.0 repository to host maven packages in our organization.
Recently I started encountering the error like
   Item not found on path "/com/rsa/appliance/appliance-distribution/3.1.3-SNAPSHOT/"!
when I click to download this package from nexus GUI, even though a maven build has successfully uploaded this package to the server, which I verified by logging into the machine which is hosting nexus (a RHEL m/c)

Issue:

The Not Found Cache is getting populated with these artifacts. Need to clear the cache for the repo and try the request again. 


Solution:
 Login to Nexus as Admin and browse -> Repositories -> Right click on repository which is giving the issue (in our case it's snapshots) -> Expire Cache

This has solved our issue.

Tuesday, January 3, 2012

Encrypting using GPG - an example

GPG stands for Gnu Privacy Guard, is a tool used to sign and encrypt data. Here I'm giving a simple usage of this tool.
Usecase: We have a file on linux server, which needs to be encrypted and delivered to another machine.

Solution:
  • By default every linux server comes with "gpg" tool. You can verify by running the command "which gpg"
  • Use gpg command to encrypt your file
           cd TO_YOUR_FILE_LOCATION   (I need to encrypt a file named CONARY)
           
           gpg -c CONARY           (It will ask for the passphrase/password, give a strong one and remember it)
           It creates a file named CONARY.gpg, which is encrypted. You can take a look at the content of this file
  • Using gpg command for decryption
          Now I have transferred this encrypted file (CONARY.gpg) to another server where gpg utility is available and run below command to decrypt it
         gpg -o CONARY -d CONARY.gpg
      
          Where -o option tells to create a file CONARY, instead of printing output on console


Strengthening encryption using AES256 cipher algo


Command to Encrypt
gpg --symmetric --cipher-algo aes256 -o dpm-3.2-src.tar.gz.gpg dpm-3.2-src.tar.gz
Enter passphrase: *******
Repeat passphrase: *******

Command to decrypt
gpg -d -o dpm-3.2-src.tar.gz  dpm-3.2-src.tar.gz.gpg


gpg: AES256 encrypted data
Enter passphrase: *******