Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1010525
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T09:05:45+00:00 2026-05-16T09:05:45+00:00

For example, if I have two files: file1: This is file 1 and file2:

  • 0

For example, if I have two files:

file1:

This is file 1

and file2:

This is file 2

and create patch with the following command:

diff -u file1 file2 > files.patch

result is:

--- file1       Fri Aug 13 17:53:28 2010
+++ file2       Fri Aug 13 17:53:38 2010
@@ -1,1 +1,1 @@
-This is file 1
+This is file 2

Then if I try to apply this patch on Solaris with patch command:

patch -u -i files.patch

it hangs on:

 Looks like a unified context diff.
File to patch:

1. Is there a way to use Solaris native patch command with unified diffs?

2. Which diff format is considered most portable if it’s not possible to apply unified format?

Update:
I’ve found answer on the first part of my question. Seems that patch on Solaris hangs if the second file (file2 in this case) exists in the same folder as the first one (file1). For example, the following quite common diff:

--- a/src/file.src       Sat Aug 14 23:07:29 2010
+++ b/src/file.src       Sat Aug 14 23:07:37 2010
@@ -1,2 +1,1 @@
-1
-
+2

will not work with quite common patch command:

patch -p1 -u -d a < file.patch

while the following diff (note second file is renamed):

--- a/src/file.src       Sat Aug 14 23:07:29 2010
+++ b/src/file_new.src       Sat Aug 14 23:07:37 2010
@@ -1,2 +1,1 @@
-1
-
+2

will work perfectly.

For the second part of my question see accepted answer below.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T09:05:46+00:00Added an answer on May 16, 2026 at 9:05 am

    Single Unix v2 and v3 both support context diffs but not unified diffs, so for better portability you should use context diffs (-c option to diff and patch).

    On older Solaris releases (pre-10, I think), you need to make sure that /usr/xpg4/bin is before /usr/bin in your $PATH, otherwise you may get compatibility versions of some utilities instead of standard ones.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In the following example I have two years worth of data denoted by data_2007
I have two example. First is true and second is wrong. It's just different
Let's take an example where we have two entities: ServiceProvider and TelephoneNumber . The
I have two websites: http://example.com http://example.com/sub I have a page, let's say: http://example.com/sub/page1 Is
I have two html pages on my webserver www.example.com/desktop.html www.example.com/mobile.html In principle the content
I have two virtual hosts on windows(for example: test1.dev and test2.dev). But it always
We have two A records pointing to same public IP address as: www.example.com IN
I have two tables, for example: Table A Table B ======= ======= Name |
A have two entities. For example timing settings and orders. @Entity public class TimingSettings{
I have two curves, one inside another, for example ellipse inside circle. I need

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.